@Test public void createMailbox() throws Exception { final String mailboxAddress = "foo@xcmailr.test"; final long expirationDate = System.currentTimeMillis(); final boolean forwardEnabled = true; final HttpResponse response = apiClient.createMailbox(mailboxAddress, expirationDate, forwardEnabled); RestApiTestUtils.validateStatusCode(response, 201); final MailboxData mailboxData = RestApiTestUtils.getResponseBodyAs(response, MailboxData.class); RestApiTestUtils.validateMailboxData(mailboxData, mailboxAddress, expirationDate, forwardEnabled); MBox mailbox = MBox.getByAddress(mailboxData.address); RestApiTestUtils.validateMailbox(mailbox, mailboxData); }
public Result createMailbox(@JSR303Validation final MailboxData mailboxData, @Attribute("user") final User user, final Context context) { if (context.getValidation().hasViolations()) { return ApiResults.badRequest(context.getValidation().getViolations()); } return doCreateMailbox(mailboxData, user); }
MailboxApiController extends AbstractApiController { public Result createMailbox(@JSR303Validation final MailboxData mailboxData, @Attribute("user") final User user, final Context context) { if (context.getValidation().hasViolations()) { return ApiResults.badRequest(context.getValidation().getViolations()); } return doCreateMailbox(mailboxData, user); } }
MailboxApiController extends AbstractApiController { public Result createMailbox(@JSR303Validation final MailboxData mailboxData, @Attribute("user") final User user, final Context context) { if (context.getValidation().hasViolations()) { return ApiResults.badRequest(context.getValidation().getViolations()); } return doCreateMailbox(mailboxData, user); }  }
MailboxApiController extends AbstractApiController { public Result createMailbox(@JSR303Validation final MailboxData mailboxData, @Attribute("user") final User user, final Context context) { if (context.getValidation().hasViolations()) { return ApiResults.badRequest(context.getValidation().getViolations()); } return doCreateMailbox(mailboxData, user); }  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 createMailbox(@JSR303Validation final MailboxData mailboxData, @Attribute("user") final User user, final Context context) { if (context.getValidation().hasViolations()) { return ApiResults.badRequest(context.getValidation().getViolations()); } return doCreateMailbox(mailboxData, user); }  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);  }