### Question:
MailApiController extends AbstractApiController { public Result deleteMail(@PathParam("mailId") @DbId final Long mailId, @Attribute("userId") @DbId final Long userId, final Context context) { return performAction(mailId, userId, context, mail -> { mail.delete(); return ApiResults.noContent(); }); }  Result listMails(@Param("mailboxAddress") @Email final String mailboxAddress,
                            @Attribute("userId") @DbId final Long userId, final Context context); Result getMail(@PathParam("mailId") @DbId final Long mailId, @Attribute("userId") @DbId final Long userId,
                          final Context context); Result getMailAttachment(@PathParam("mailId") @DbId final Long mailId,
                                    @PathParam("attachmentName") @NotBlank final String attachmentName,
                                    @Attribute("userId") @DbId final Long userId, final Context context); Result deleteMail(@PathParam("mailId") @DbId final Long mailId, @Attribute("userId") @DbId final Long userId,
                             final Context context);  }### Answer:
@Test public void deleteMail() throws Exception { final Mail mail = TestDataUtils.createMailWithAttachments(mailbox); Assert.assertNotNull(Ebean.find(Mail.class, mail.getId())); final HttpResponse response = apiClient.deleteMail(String.valueOf(mail.getId())); RestApiTestUtils.validateStatusCode(response, 204); Assert.assertNull(Ebean.find(Mail.class, mail.getId())); }
@Test public void deleteMail_someoneElsesMail() throws Exception { final HttpResponse response = apiClient.deleteMail(otherUsersMailId); RestApiTestUtils.validateStatusCode(response, 403); RestApiTestUtils.validateErrors(response, "mailId"); }
@Test public void deleteMail_invalidMailId() throws Exception { final HttpResponse response = apiClient.deleteMail(invalidId); RestApiTestUtils.validateStatusCode(response, 400); RestApiTestUtils.validateErrors(response, "mailId"); }
@Test public void deleteMail_unknownMailId() throws Exception { final HttpResponse response = apiClient.deleteMail(unknownId); RestApiTestUtils.validateStatusCode(response, 404); }