ObservableManager { public ObservableGroup getGroup(long groupId) { ObservableGroup observableGroup = observableGroupMap.get(groupId); if (observableGroup == null) { throw new IllegalArgumentException("Group not found with groupId=" + groupId); } if (observableGroup.isDestroyed()) { throw new IllegalArgumentException("Group is already destroyed with groupId=" + groupId); } return observableGroup; }  ObservableGroup getGroup(long groupId); ObservableGroup newGroup(); void destroy(ObservableGroup group);  }
@Test public void testGetGroup() { ObservableGroup originalGroup = observableManager.newGroup(); ObservableGroup group = observableManager.getGroup(originalGroup.id()); assertThat(group.id()).isEqualTo(1); }
@Test public void testGetGroupThrowsIfNonExistent() { try { observableManager.getGroup(1); fail(); } catch (IllegalArgumentException ignored) { } }