@Test public final void testSetGroupInvalid() { // Use an EditBooleanVar to test since it is a very basic // implementation of EditBaseVar. final EditBaseVar ev = new EditBooleanVar(fModelService); ev.setGroupId(90); assertFalse("Optional should not contain a group", ev.getGroup().isPresent()); }
@Test public final void testSetGroupValid() { // Setup final VariableGroup newGroup = fModelService.getAllVariableGroups().iterator().next(); // Use an EditBooleanVar to test since it is a very basic // implementation of EditBaseVar. final EditBaseVar ev = new EditBooleanVar(fModelService); // Ensure we're actually going to test something here. assertNotEquals(newGroup.getId(), ev.getGroupId()); // Operation ev.setGroupId(newGroup.getId()); // Verification assertEquals(newGroup.getId(), ev.getGroupId()); assertEquals(newGroup, ev.getGroup().get()); }