@Test public void testCompare() { MetaData metaData1 = mock( MetaData.class ); MetaData metaData2 = mock( MetaData.class ); doReturn( "name_0" ).when( metaData1 ).getDisplayName( locale ); doReturn( "name_1" ).when( metaData2 ).getDisplayName( locale ); assertThat( comparator.compare( metaData1, metaData2 ), is( equalTo( -1 ) ) ); doReturn( "name_0" ).when( metaData2 ).getDisplayName( locale ); doReturn( "1" ).when( metaData1 ).getGrouping( locale ); doReturn( "0" ).when( metaData2 ).getGrouping( locale ); assertThat( comparator.compare( metaData1, metaData2 ), is( equalTo( 1 ) ) ); }
public int compare( final MetaData metaData1, final MetaData metaData2 ) { final String s1 = metaData1.getDisplayName( locale ); final String s2 = metaData2.getDisplayName( locale ); final int nameCompareResult = s1.compareTo( s2 ); if ( nameCompareResult != 0 ) { return nameCompareResult; } final String g1 = metaData1.getGrouping( locale ); final String g2 = metaData2.getGrouping( locale ); return g1.compareTo( g2 ); }
PlainMetaDataComparator implements Comparator<MetaData> { public int compare( final MetaData metaData1, final MetaData metaData2 ) { final String s1 = metaData1.getDisplayName( locale ); final String s2 = metaData2.getDisplayName( locale ); final int nameCompareResult = s1.compareTo( s2 ); if ( nameCompareResult != 0 ) { return nameCompareResult; } final String g1 = metaData1.getGrouping( locale ); final String g2 = metaData2.getGrouping( locale ); return g1.compareTo( g2 ); } }
PlainMetaDataComparator implements Comparator<MetaData> { public int compare( final MetaData metaData1, final MetaData metaData2 ) { final String s1 = metaData1.getDisplayName( locale ); final String s2 = metaData2.getDisplayName( locale ); final int nameCompareResult = s1.compareTo( s2 ); if ( nameCompareResult != 0 ) { return nameCompareResult; } final String g1 = metaData1.getGrouping( locale ); final String g2 = metaData2.getGrouping( locale ); return g1.compareTo( g2 ); } PlainMetaDataComparator(); }
PlainMetaDataComparator implements Comparator<MetaData> { public int compare( final MetaData metaData1, final MetaData metaData2 ) { final String s1 = metaData1.getDisplayName( locale ); final String s2 = metaData2.getDisplayName( locale ); final int nameCompareResult = s1.compareTo( s2 ); if ( nameCompareResult != 0 ) { return nameCompareResult; } final String g1 = metaData1.getGrouping( locale ); final String g2 = metaData2.getGrouping( locale ); return g1.compareTo( g2 ); } PlainMetaDataComparator(); int compare( final MetaData metaData1, final MetaData metaData2 ); }
PlainMetaDataComparator implements Comparator<MetaData> { public int compare( final MetaData metaData1, final MetaData metaData2 ) { final String s1 = metaData1.getDisplayName( locale ); final String s2 = metaData2.getDisplayName( locale ); final int nameCompareResult = s1.compareTo( s2 ); if ( nameCompareResult != 0 ) { return nameCompareResult; } final String g1 = metaData1.getGrouping( locale ); final String g2 = metaData2.getGrouping( locale ); return g1.compareTo( g2 ); } PlainMetaDataComparator(); int compare( final MetaData metaData1, final MetaData metaData2 );  }