WroModel { public void merge(final WroModel importedModel) { Validate.notNull(importedModel, "imported model cannot be null!"); LOG.debug("merging importedModel: {}", importedModel); for (final String groupName : new WroModelInspector(importedModel).getGroupNames()) { if (new WroModelInspector(this).getGroupNames().contains(groupName)) { throw new WroRuntimeException("Duplicate group name detected: " + groupName); } final Group importedGroup = new WroModelInspector(importedModel).getGroupByName(groupName); addGroup(importedGroup); } }  final Collection<Group> getGroups(); final WroModel setGroups(final Collection<Group> groups); void merge(final WroModel importedModel); WroModel addGroup(final Group group); @Override boolean equals(final Object obj); @Override int hashCode(); @Override String toString();  }
@Test(expected = NullPointerException.class) public void cannotMergeNullModel() { victim.merge(null); }
@Test public void shouldMergeEmptyModel() { victim.merge(new WroModel()); assertEquals(buildValidModel(), victim); }