### Question:
ItemDefinitionUpdateHandler { QName makeQName(final DataType dataType) { return normaliseTypeRef(makeQName(dataType.getType())); } @Inject  ItemDefinitionUpdateHandler(final DataTypeManager dataTypeManager,
                                       final ItemDefinitionUtils itemDefinitionUtils,
                                       final PropertiesPanelNotifier panelNotifier,
                                       final Event<DataTypeChangedEvent> dataTypeChangedEvent); void update(final DataType dataType,
                       final ItemDefinition itemDefinition);  }### Answer:
@Test public void testMakeQNameWhenDataTypeIsDefault() { final DataType dataType = mock(DataType.class); final String expectedName = "string"; when(dataType.getType()).thenReturn(expectedName); final QName name = handler.makeQName(dataType); final String actualName = name.getLocalPart(); assertEquals(expectedName, actualName); assertEquals(QName.NULL_NS_URI, name.getNamespaceURI()); }
@Test public void testMakeQNameWhenDataTypeIsNotDefault() { final DataType dataType = mock(DataType.class); final String expectedName = "tAddress"; when(dataType.getType()).thenReturn(expectedName); final QName name = handler.makeQName(dataType); final String actual = name.toString(); final String expected = "tAddress"; assertEquals(expected, actual); assertEquals(QName.NULL_NS_URI, name.getNamespaceURI()); }
@Test public void testMakeQNameWithItemDefinition() { final ItemDefinition itemDefinition = mock(ItemDefinition.class); final Name itemDefinitionName = mock(Name.class); final String expectedName = "tAddress"; when(itemDefinitionName.getValue()).thenReturn(expectedName); when(itemDefinition.getName()).thenReturn(itemDefinitionName); final QName name = handler.makeQName(itemDefinition); final String actual = name.toString(); final String expected = "tAddress"; assertEquals(expected, actual); assertEquals(QName.NULL_NS_URI, name.getNamespaceURI()); }