### Question:
NodeFactoryImpl extends AbstractElementFactory<Object, Definition<Object>, Node<Definition<Object>, Edge>> implements NodeFactory<Object> { @Override @SuppressWarnings("unchecked") public Node<Definition<Object>, Edge> build(final String uuid, final Object definition) { final NodeImpl node = new NodeImpl<>(uuid); final Bounds bounds = definitionUtils.buildBounds(definition, 0d, 0d); View<Object> content = new ViewImpl<>(definition, bounds); node.setContent(content); appendLabels(node.getLabels(), definition); return node; } protected  NodeFactoryImpl(); @Inject  NodeFactoryImpl(final DefinitionUtils definitionUtils); @Override Class<? extends ElementFactory> getFactoryType(); @Override @SuppressWarnings("unchecked") Node<Definition<Object>, Edge> build(final String uuid,
                                                final Object definition); @Override boolean accepts(final Object source);  }### Answer:
@Test @SuppressWarnings("unchecked") public void testBuild() { when(testingkHelper.getDefinitionAdapter().getId(eq(definition))).thenReturn(DefinitionId.build(DEF_ID)); final Node<Definition<Object>, Edge> node = tested.build(UUID, definition); assertNotNull(node); assertEquals(UUID, node.getUUID()); assertEquals(3, node.getLabels().size()); assertTrue(node.getLabels().contains(DEF_ID)); assertTrue(node.getLabels().contains("label1")); assertTrue(node.getLabels().contains("label2")); }
@Test @SuppressWarnings("unchecked") public void testBuildDynamicDefinition() { when(testingkHelper.getDefinitionAdapter().getId(eq(definition))).thenReturn(DefinitionId.build(DEF_TYPE_ID, DEF_ID)); final Node<Definition<Object>, Edge> node = tested.build(UUID, definition); assertNotNull(node); assertEquals(UUID, node.getUUID()); assertEquals(4, node.getLabels().size()); assertTrue(node.getLabels().contains(DefinitionId.generateId(DEF_TYPE_ID, DEF_ID))); assertTrue(node.getLabels().contains(DEF_TYPE_ID)); assertTrue(node.getLabels().contains("label1")); assertTrue(node.getLabels().contains("label2")); }