@Test
public void testHierEncoderDecoderUpper() {
HierarchyEncoder encoder = new HierarchyEncoderImpl();
encoder.encode( "Thing", Collections.EMPTY_LIST );
encoder.encode( "A", Arrays.asList( "Thing" ) );
encoder.encode( "Z", Arrays.asList( "Thing" ) );
encoder.encode( "B", Arrays.asList( "A", "Z" ) );
encoder.encode( "C", Arrays.asList( "A", "Z" ) );
encoder.encode( "N", Arrays.asList( "B", "C" ) );
encoder.encode( "P", Arrays.asList( "Thing" ) );
encoder.encode( "Q", Arrays.asList( "Thing" ) );
encoder.encode( "R", Arrays.asList( "Thing" ) );
encoder.encode( "S", Arrays.asList( "R" ) );
encoder.encode( "T", Arrays.asList( "C", "Q" ) );
encoder.encode( "M", Arrays.asList( "R", "Q" ) );
encoder.encode( "O", Arrays.asList( "M", "P" ) );
System.out.println( encoder );
Collection x;
x = encoder.upperBorder( encoder.metMembersCode( Arrays.asList( "B" ) ) );
System.out.println( "LCS " + x );
assertEquals( 1, x.size() );
assertTrue( x.contains( "B" ) );
x = encoder.immediateParents( encoder.metMembersCode( Arrays.asList( "B" ) ) );
System.out.println( "LCS " + x );
assertEquals( 2, x.size() );
assertTrue( x.contains( "A" ) );
assertTrue( x.contains( "Z" ) );
x = encoder.upperBorder( encoder.jointMembersCode( Arrays.asList( "Z", "Q" ) ) );
System.out.println( "LCS " + x );
assertEquals( 1, x.size() );
assertTrue( x.contains( "Thing" ) );
x = encoder.immediateParents( encoder.jointMembersCode( Arrays.asList( "Z", "Q" ) ) );
System.out.println( "LCS " + x );
assertEquals( 1, x.size() );
assertTrue( x.contains( "Thing" ) );
x = encoder.upperBorder( encoder.jointMembersCode( Arrays.asList( "B", "C" ) ) );
System.out.println( "LCS " + x );
assertEquals( 2, x.size() );
assertTrue( x.contains( "A" ) );
assertTrue( x.contains( "Z" ) );
x = encoder.immediateParents( encoder.jointMembersCode( Arrays.asList( "B", "C" ) ) );
System.out.println( "LCS " + x );
assertEquals( 2, x.size() );
assertTrue( x.contains( "A" ) );
assertTrue( x.contains( "Z" ) );
x = encoder.upperBorder( encoder.jointMembersCode( Arrays.asList( "T" ) ) );
System.out.println( "LCS " + x );
assertEquals( 1, x.size() );
assertTrue( x.contains( "T" ) );
x = encoder.immediateParents( encoder.jointMembersCode( Arrays.asList( "T" ) ) );
System.out.println( "LCS " + x );
assertEquals( 2, x.size() );
assertTrue( x.contains( "C" ) );
assertTrue( x.contains( "Q" ) );