### Question:
DefaultHateoasContext implements HateoasContext { @Override public LinkableInfo getLinkableInfo(String link) { LinkableInfo linkableInfo = linkableMapping.get(link); Validate.notNull(linkableInfo, "Invalid link: " + link); return linkableInfo; }  @Override void mapClass(Class<?> clazz); @Override LinkableInfo getLinkableInfo(String link); @Override String toString(); boolean isInitialized(Class<?> clazz);  }### Answer:
@Test public void verifyDeleteMethod() { LinkableInfo result = tested.getLinkableInfo("test.dummy.delete"); assertEquals("test.dummy.delete", result.getId()); assertEquals("DELETE", result.getHttpMethod()); assertEquals("/dummy", result.getMethodPath()); }
@Test public void verifySubpath() { LinkableInfo result = tested.getLinkableInfo("test.dummy.get.subpath"); assertEquals("test.dummy.get.subpath", result.getId()); assertEquals("GET", result.getHttpMethod()); assertEquals("/dummy/subpath", result.getMethodPath()); }
@Test public void verifySneakyPath() { LinkableInfo result = tested.getLinkableInfo("test.dummy.sneaky.get"); assertEquals("test.dummy.sneaky.get", result.getId()); assertEquals("GET", result.getHttpMethod()); assertEquals("/dummy", result.getMethodPath()); }
@Test public void verifySneakySubpath() { LinkableInfo result = tested.getLinkableInfo("test.dummy.sneaky.subpath"); assertEquals("test.dummy.sneaky.subpath", result.getId()); assertEquals("GET", result.getHttpMethod()); assertEquals("/dummy/subpath", result.getMethodPath()); }
@Test public void verifySubResources() throws Exception { LinkableInfo result = tested.getLinkableInfo("dummy.root.resource.get"); assertEquals("dummy.root.resource.get", result.getId()); assertEquals("GET", result.getHttpMethod()); assertEquals("/root", result.getMethodPath()); result = tested.getLinkableInfo("dummy.sub.resource.get"); assertEquals("dummy.sub.resource.get", result.getId()); assertEquals("GET", result.getHttpMethod()); assertEquals("/root/{id}", result.getMethodPath()); }
@Test(expected = IllegalArgumentException.class) public void unmappedLinkThrowsException() { tested.getLinkableInfo("not.mapped"); }