ExpenseLinkFactory implements LinkFactory<Expense> { @Override public URI createLinkTo(Expense expense) { final String nobtId = nobt.getId().getValue(); final long expenseId = expense.getId(); return URI.create(String.format("%s/nobts/%s/expenses/%d", basePath.asString(), nobtId, expenseId)); } ExpenseLinkFactory(BasePath basePath, Nobt nobt); @Override URI createLinkTo(Expense expense);  }
@Test public void shouldCreateUri() { final Nobt nobt = aNobt().withId(new NobtId("foo")).build(); final LinkFactory<Expense> expenseLinkFactory = new ExpenseLinkFactory(new BasePath("http", "localhost:1234"), nobt); final URI linkToExpense = expenseLinkFactory.createLinkTo(anExpense().withId(1).build()); Assert.assertEquals("http: }