@Test public void testGetHref() { final DRGElement drgElement = mock(DRGElement.class); final Name name = mock(Name.class); final Id id = mock(Id.class); final Definitions definitions = mock(Definitions.class); final String uuid = "0000-1111-2222"; when(id.getValue()).thenReturn(uuid); when(name.getValue()).thenReturn("Decision"); when(drgElement.getId()).thenReturn(id); when(drgElement.getName()).thenReturn(name); when(drgElement.getParent()).thenReturn(definitions); when(definitions.getImport()).thenReturn(Collections.emptyList()); final String actual = HrefBuilder.getHref(drgElement); final String expected = "#" + uuid; assertEquals(expected, actual); }
public static String getHref(final DRGElement drgElement) { final String drgElementId = drgElement.getId().getValue(); return getNamespace(drgElement) .map(namespace -> namespace + "#" + drgElementId) .orElse("#" + drgElementId); }
HrefBuilder { public static String getHref(final DRGElement drgElement) { final String drgElementId = drgElement.getId().getValue(); return getNamespace(drgElement) .map(namespace -> namespace + "#" + drgElementId) .orElse("#" + drgElementId); } }
HrefBuilder { public static String getHref(final DRGElement drgElement) { final String drgElementId = drgElement.getId().getValue(); return getNamespace(drgElement) .map(namespace -> namespace + "#" + drgElementId) .orElse("#" + drgElementId); }  }
HrefBuilder { public static String getHref(final DRGElement drgElement) { final String drgElementId = drgElement.getId().getValue(); return getNamespace(drgElement) .map(namespace -> namespace + "#" + drgElementId) .orElse("#" + drgElementId); }  static String getHref(final DRGElement drgElement); }
HrefBuilder { public static String getHref(final DRGElement drgElement) { final String drgElementId = drgElement.getId().getValue(); return getNamespace(drgElement) .map(namespace -> namespace + "#" + drgElementId) .orElse("#" + drgElementId); }  static String getHref(final DRGElement drgElement);  }