Java Code Examples for com.helger.commons.id.IHasID#getComparatorID()

The following examples show how to use com.helger.commons.id.IHasID#getComparatorID() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ChildrenProviderSortingTest.java    From ph-commons with Apache License 2.0 6 votes vote down vote up
@Test
public void testAll ()
{
  final ChildrenProviderSorting <MockHasChildren> cr = new ChildrenProviderSorting <> (new MockChildrenProvider (),
                                                                                       IHasID.getComparatorID ());
  assertFalse (cr.hasChildren (null));
  assertEquals (0, cr.getChildCount (null));
  assertNull (cr.getAllChildren (null));
  final MockHasChildren hca = new MockHasChildren ("a");
  final MockHasChildren hcb = new MockHasChildren ("b");
  final MockHasChildren hc1 = new MockHasChildren ("1", hcb, hca);
  assertTrue (cr.hasChildren (hc1));
  assertFalse (cr.hasChildren (hca));
  assertEquals (2, cr.getChildCount (hc1));
  assertEquals (0, cr.getChildCount (hca));
  assertNotNull (cr.getAllChildren (hc1));
  assertNotNull (cr.getAllChildren (hca));
}
 
Example 2
Source File: ChildrenProviderSortingWithIDTest.java    From ph-commons with Apache License 2.0 6 votes vote down vote up
@Test
public void testAll ()
{
  final ChildrenProviderSortingWithID <String, MockHasChildren> cr = new ChildrenProviderSortingWithID <> (new MockChildrenProviderWithID (),
                                                                                                           IHasID.getComparatorID ());
  assertFalse (cr.hasChildren (null));
  assertEquals (0, cr.getChildCount (null));
  assertNull (cr.getAllChildren (null));
  final MockHasChildren hca = new MockHasChildren ("a");
  final MockHasChildren hcb = new MockHasChildren ("b");
  final MockHasChildren hc1 = new MockHasChildren ("1", hcb, hca);
  assertTrue (cr.hasChildren (hc1));
  assertFalse (cr.hasChildren (hca));
  assertEquals (2, cr.getChildCount (hc1));
  assertEquals (0, cr.getChildCount (hca));
  assertNotNull (cr.getAllChildren (hc1));
  assertNotNull (cr.getAllChildren (hca));
  assertSame (hca, cr.getChildWithID (hc1, "a"));
  assertSame (hcb, cr.getChildWithID (hc1, "b"));
  assertNull (cr.getChildWithID (hc1, "anyid"));
}
 
Example 3
Source File: ChildrenProviderHasChildrenSortingTest.java    From ph-commons with Apache License 2.0 6 votes vote down vote up
@Test
public void testAll ()
{
  final ChildrenProviderHasChildrenSorting <MockHasChildren> cr = new ChildrenProviderHasChildrenSorting <> (IHasID.getComparatorID ());
  assertFalse (cr.hasChildren (null));
  assertEquals (0, cr.getChildCount (null));
  assertNull (cr.getAllChildren (null));
  final MockHasChildren hca = new MockHasChildren ("a");
  final MockHasChildren hcb = new MockHasChildren ("b");
  final MockHasChildren hc1 = new MockHasChildren ("1", hcb, hca);
  assertTrue (cr.hasChildren (hc1));
  assertFalse (cr.hasChildren (hca));
  assertEquals (2, cr.getChildCount (hc1));
  assertEquals (0, cr.getChildCount (hca));
  assertNotNull (cr.getAllChildren (hc1));
  assertNotNull (cr.getAllChildren (hca));
}