@Test public void shouldCreateResource() { Account entity = AccountTestUtils.createCheckingsAccount(UserTestUtils.createBob()); AccountResource resource = testSubject.toResource(entity); assertThat(resource.getDescription()).isEqualTo(entity.getDescription()); assertThat(resource.getOnBudget()).isEqualTo(entity.isOnBudget()); }
@Override public AccountResource toResource(Account entity) { final AccountResource accountResource = new AccountResource(entity.getDescription(), entity.isOnBudget()); accountResource.add(linkTo(methodOn(AccountController.class).get(entity.getUser().getId(), entity.getId())).withSelfRel()); accountResource.add(linkTo(methodOn(UserController.class).get(entity.getUser().getId())).withRel("user")); return accountResource; }
AccountResourceAssembler extends ResourceAssemblerSupport<Account, AccountResource> { @Override public AccountResource toResource(Account entity) { final AccountResource accountResource = new AccountResource(entity.getDescription(), entity.isOnBudget()); accountResource.add(linkTo(methodOn(AccountController.class).get(entity.getUser().getId(), entity.getId())).withSelfRel()); accountResource.add(linkTo(methodOn(UserController.class).get(entity.getUser().getId())).withRel("user")); return accountResource; } }
AccountResourceAssembler extends ResourceAssemblerSupport<Account, AccountResource> { @Override public AccountResource toResource(Account entity) { final AccountResource accountResource = new AccountResource(entity.getDescription(), entity.isOnBudget()); accountResource.add(linkTo(methodOn(AccountController.class).get(entity.getUser().getId(), entity.getId())).withSelfRel()); accountResource.add(linkTo(methodOn(UserController.class).get(entity.getUser().getId())).withRel("user")); return accountResource; } AccountResourceAssembler(); }
AccountResourceAssembler extends ResourceAssemblerSupport<Account, AccountResource> { @Override public AccountResource toResource(Account entity) { final AccountResource accountResource = new AccountResource(entity.getDescription(), entity.isOnBudget()); accountResource.add(linkTo(methodOn(AccountController.class).get(entity.getUser().getId(), entity.getId())).withSelfRel()); accountResource.add(linkTo(methodOn(UserController.class).get(entity.getUser().getId())).withRel("user")); return accountResource; } AccountResourceAssembler(); @Override AccountResource toResource(Account entity); }
AccountResourceAssembler extends ResourceAssemblerSupport<Account, AccountResource> { @Override public AccountResource toResource(Account entity) { final AccountResource accountResource = new AccountResource(entity.getDescription(), entity.isOnBudget()); accountResource.add(linkTo(methodOn(AccountController.class).get(entity.getUser().getId(), entity.getId())).withSelfRel()); accountResource.add(linkTo(methodOn(UserController.class).get(entity.getUser().getId())).withRel("user")); return accountResource; } AccountResourceAssembler(); @Override AccountResource toResource(Account entity);  }