RequiredFlag { public static Boolean choose(Boolean parent, Boolean child) { if (parent == Boolean.TRUE || child == Boolean.TRUE) { return true; } return parent == null ? child : parent; }  static Boolean choose(Boolean parent, Boolean child);  }
@Test public void testBothNull() { assertNull(RequiredFlag.choose(null, null)); }
@Test public void testParentNull() { assertNull(RequiredFlag.choose(null, null)); assertFalse(RequiredFlag.choose(null, false)); assertTrue(RequiredFlag.choose(null, true)); }
@Test public void testTrue() { assertTrue(RequiredFlag.choose(true, null)); assertTrue(RequiredFlag.choose(true, false)); assertTrue(RequiredFlag.choose(true, true)); }
@Test public void testParentFalse() { assertFalse(RequiredFlag.choose(false, null)); assertFalse(RequiredFlag.choose(false, false)); assertTrue(RequiredFlag.choose(false, true)); }