@Test public void testCompareNullKey() throws Exception { // Two null objects are equal. assertEquals(0, comparator.compare(null, null)); // Null is less than an object. assertEquals(-1, comparator.compare(null, new BusinessObjectDataKey())); // An object is greater than null. assertEquals(1, comparator.compare(new BusinessObjectDataKey(), null)); }
Collections.sort(businessObjectDataKeys, new BusinessObjectDataKeyComparator()); Collections.sort(businessObjectDataKeys, new BusinessObjectDataKeyComparator());
Collections.sort(businessObjectDataKeys, new BusinessObjectDataKeyComparator()); Collections.sort(businessObjectDataKeys, new BusinessObjectDataKeyComparator());
request.getBusinessObjectDataParents().sort(new BusinessObjectDataKeyComparator()); assertEquals(request.getBusinessObjectDataParents(), businessObjectData.getBusinessObjectDataParents());
@Test public void testCompareBusinessObjectFormatVersion() throws Exception { BusinessObjectDataKey businessObjectDataKey1 = new BusinessObjectDataKey(); BusinessObjectDataKey businessObjectDataKey2 = new BusinessObjectDataKey(); // "a" = "b" businessObjectDataKey1.setBusinessObjectFormatVersion(0); businessObjectDataKey2.setBusinessObjectFormatVersion(0); assertEquals(0, comparator.compare(businessObjectDataKey1, businessObjectDataKey2)); // "a" < "b" businessObjectDataKey1.setBusinessObjectFormatVersion(0); businessObjectDataKey2.setBusinessObjectFormatVersion(1); assertEquals(-1, comparator.compare(businessObjectDataKey1, businessObjectDataKey2)); // "b" > "a" assertEquals(1, comparator.compare(businessObjectDataKey2, businessObjectDataKey1)); }
@Test public void testCompareBusinessObjectDataVersion() throws Exception { BusinessObjectDataKey businessObjectDataKey1 = new BusinessObjectDataKey(); BusinessObjectDataKey businessObjectDataKey2 = new BusinessObjectDataKey(); // "a" = "b" businessObjectDataKey1.setBusinessObjectDataVersion(0); businessObjectDataKey2.setBusinessObjectDataVersion(0); assertEquals(0, comparator.compare(businessObjectDataKey1, businessObjectDataKey2)); // "a" < "b" businessObjectDataKey1.setBusinessObjectDataVersion(0); businessObjectDataKey2.setBusinessObjectDataVersion(1); assertEquals(-1, comparator.compare(businessObjectDataKey1, businessObjectDataKey2)); // "b" > "a" assertEquals(1, comparator.compare(businessObjectDataKey2, businessObjectDataKey1)); }
@Test public void testCompareBusinessObjectFormatFileType() throws Exception { BusinessObjectDataKey businessObjectDataKey1 = new BusinessObjectDataKey(); BusinessObjectDataKey businessObjectDataKey2 = new BusinessObjectDataKey(); // "a" = "b" businessObjectDataKey1.setBusinessObjectFormatFileType("a"); businessObjectDataKey2.setBusinessObjectFormatFileType("a"); assertEquals(0, comparator.compare(businessObjectDataKey1, businessObjectDataKey2)); // "a" < "b" businessObjectDataKey1.setBusinessObjectFormatFileType("a"); businessObjectDataKey2.setBusinessObjectFormatFileType("b"); assertEquals(-1, comparator.compare(businessObjectDataKey1, businessObjectDataKey2)); // "b" > "a" assertEquals(1, comparator.compare(businessObjectDataKey2, businessObjectDataKey1)); }
@Test public void testComparePartitionValue() throws Exception { BusinessObjectDataKey businessObjectDataKey1 = new BusinessObjectDataKey(); BusinessObjectDataKey businessObjectDataKey2 = new BusinessObjectDataKey(); // "a" = "b" businessObjectDataKey1.setPartitionValue("a"); businessObjectDataKey2.setPartitionValue("a"); assertEquals(0, comparator.compare(businessObjectDataKey1, businessObjectDataKey2)); // "a" < "b" businessObjectDataKey1.setPartitionValue("a"); businessObjectDataKey2.setPartitionValue("b"); assertEquals(-1, comparator.compare(businessObjectDataKey1, businessObjectDataKey2)); // "b" > "a" assertEquals(1, comparator.compare(businessObjectDataKey2, businessObjectDataKey1)); }
@Test public void testCompareBusinessObjectDefinitionName() throws Exception { BusinessObjectDataKey businessObjectDataKey1 = new BusinessObjectDataKey(); BusinessObjectDataKey businessObjectDataKey2 = new BusinessObjectDataKey(); // "a" = "b" businessObjectDataKey1.setBusinessObjectDefinitionName("a"); businessObjectDataKey2.setBusinessObjectDefinitionName("a"); assertEquals(0, comparator.compare(businessObjectDataKey1, businessObjectDataKey2)); // "a" < "b" businessObjectDataKey1.setBusinessObjectDefinitionName("a"); businessObjectDataKey2.setBusinessObjectDefinitionName("b"); assertEquals(-1, comparator.compare(businessObjectDataKey1, businessObjectDataKey2)); // "b" > "a" assertEquals(1, comparator.compare(businessObjectDataKey2, businessObjectDataKey1)); }
@Test public void testCompareBusinessObjectFormatUsage() throws Exception { BusinessObjectDataKey businessObjectDataKey1 = new BusinessObjectDataKey(); BusinessObjectDataKey businessObjectDataKey2 = new BusinessObjectDataKey(); // "a" = "b" businessObjectDataKey1.setBusinessObjectFormatUsage("a"); businessObjectDataKey2.setBusinessObjectFormatUsage("a"); assertEquals(0, comparator.compare(businessObjectDataKey1, businessObjectDataKey2)); // "a" < "b" businessObjectDataKey1.setBusinessObjectFormatUsage("a"); businessObjectDataKey2.setBusinessObjectFormatUsage("b"); assertEquals(-1, comparator.compare(businessObjectDataKey1, businessObjectDataKey2)); // "b" > "a" assertEquals(1, comparator.compare(businessObjectDataKey2, businessObjectDataKey1)); }