@Test public void listMailboxes_emptyList() throws Exception { final HttpResponse response = apiClient.listMailboxes(); RestApiTestUtils.validateStatusCode(response, 200); final MailboxData[] mailboxData = RestApiTestUtils.getResponseBodyAs(response, MailboxData[].class); Assert.assertEquals(0, mailboxData.length); }
public Result listMailboxes(@Attribute("userId") @DbId final Long userId, final Context context) { final List<MBox> mailboxes = MBox.allUser(userId); final List<MailboxData> mailboxDatas = mailboxes.stream().map(mb -> new MailboxData(mb)) .collect(Collectors.toList()); return ApiResults.ok().render(mailboxDatas); }
MailboxApiController extends AbstractApiController { public Result listMailboxes(@Attribute("userId") @DbId final Long userId, final Context context) { final List<MBox> mailboxes = MBox.allUser(userId); final List<MailboxData> mailboxDatas = mailboxes.stream().map(mb -> new MailboxData(mb)) .collect(Collectors.toList()); return ApiResults.ok().render(mailboxDatas); } }
MailboxApiController extends AbstractApiController { public Result listMailboxes(@Attribute("userId") @DbId final Long userId, final Context context) { final List<MBox> mailboxes = MBox.allUser(userId); final List<MailboxData> mailboxDatas = mailboxes.stream().map(mb -> new MailboxData(mb)) .collect(Collectors.toList()); return ApiResults.ok().render(mailboxDatas); }  }
MailboxApiController extends AbstractApiController { public Result listMailboxes(@Attribute("userId") @DbId final Long userId, final Context context) { final List<MBox> mailboxes = MBox.allUser(userId); final List<MailboxData> mailboxDatas = mailboxes.stream().map(mb -> new MailboxData(mb)) .collect(Collectors.toList()); return ApiResults.ok().render(mailboxDatas); }  Result listMailboxes(@Attribute("userId") @DbId final Long userId, final Context context); Result createMailbox(@JSR303Validation final MailboxData mailboxData, @Attribute("user") final User user,
                                final Context context); Result getMailbox(@PathParam("mailboxAddress") @Email final String mailboxAddress,
                             @Attribute("userId") @DbId final Long userId, final Context context); Result updateMailbox(@PathParam("mailboxAddress") @Email final String mailboxAddress,
                                @JSR303Validation final MailboxData mailboxData,
                                @Attribute("userId") @DbId final Long userId, final Context context); Result deleteMailbox(@PathParam("mailboxAddress") @Email final String mailboxAddress,
                                @Attribute("userId") @DbId final Long userId, final Context context); }
MailboxApiController extends AbstractApiController { public Result listMailboxes(@Attribute("userId") @DbId final Long userId, final Context context) { final List<MBox> mailboxes = MBox.allUser(userId); final List<MailboxData> mailboxDatas = mailboxes.stream().map(mb -> new MailboxData(mb)) .collect(Collectors.toList()); return ApiResults.ok().render(mailboxDatas); }  Result listMailboxes(@Attribute("userId") @DbId final Long userId, final Context context); Result createMailbox(@JSR303Validation final MailboxData mailboxData, @Attribute("user") final User user,
                                final Context context); Result getMailbox(@PathParam("mailboxAddress") @Email final String mailboxAddress,
                             @Attribute("userId") @DbId final Long userId, final Context context); Result updateMailbox(@PathParam("mailboxAddress") @Email final String mailboxAddress,
                                @JSR303Validation final MailboxData mailboxData,
                                @Attribute("userId") @DbId final Long userId, final Context context); Result deleteMailbox(@PathParam("mailboxAddress") @Email final String mailboxAddress,
                                @Attribute("userId") @DbId final Long userId, final Context context);  }