### Question:
ItemDefinitionUtils { public void addItemDefinitions(final List<ItemDefinition> newItemDefinitions) { final List<ItemDefinition> itemDefinitions = dmnGraphUtils.getModelDefinitions().getItemDefinition(); itemDefinitions.addAll(newItemDefinitions); } @Inject  ItemDefinitionUtils(final DMNGraphUtils dmnGraphUtils); Optional<ItemDefinition> findByName(final String name); List<ItemDefinition> all(); void addItemDefinitions(final List<ItemDefinition> newItemDefinitions); String getConstraintText(final ItemDefinition itemDefinition); QName normaliseTypeRef(final QName typeRef);  }### Answer:
@Test public void testAddItemDefinitions() { final Definitions definitions = mock(Definitions.class); final ItemDefinition itemDefinition1 = mock(ItemDefinition.class); final ItemDefinition itemDefinition2 = mock(ItemDefinition.class); final ItemDefinition itemDefinition3 = mock(ItemDefinition.class); final ItemDefinition itemDefinition4 = mock(ItemDefinition.class); final List<ItemDefinition> newItemDefinitions = asList(itemDefinition1, itemDefinition3); final List<ItemDefinition> expectedItemDefinitions = asList(itemDefinition2, itemDefinition4, itemDefinition1, itemDefinition3); final List<ItemDefinition> actualItemDefinitions = new ArrayList<>(asList(itemDefinition2, itemDefinition4)); when(dmnGraphUtils.getModelDefinitions()).thenReturn(definitions); when(definitions.getItemDefinition()).thenReturn(actualItemDefinitions); utils.addItemDefinitions(newItemDefinitions); assertEquals(expectedItemDefinitions, actualItemDefinitions); }