Search in sources :

Example 1 with MandrillRequestWithDomain

use of com.cribbstechnologies.clients.mandrill.model.MandrillRequestWithDomain in project Java-Mandrill-Wrapper by cribbstechnologies.

the class MandrillRESTRequestTest method testGetPostDataMandrillRequestWithEmail.

@Test
public void testGetPostDataMandrillRequestWithEmail() throws Exception {
    this.initRequestWithActualMapper();
    assertEquals("{\"key\":null,\"domain\":null}", this.request.getPostData(this.emptyEmailRequest));
    this.mutableEmailRequest = new MandrillRequestWithDomain();
    this.mutableEmailRequest.setKey("12345");
    this.mutableEmailRequest.setDomain("email@email.com");
    assertEquals("{\"key\":\"12345\",\"domain\":\"email@email.com\"}", this.request.getPostData(this.mutableEmailRequest));
}
Also used : MandrillRequestWithDomain(com.cribbstechnologies.clients.mandrill.model.MandrillRequestWithDomain) Test(org.junit.Test)

Example 2 with MandrillRequestWithDomain

use of com.cribbstechnologies.clients.mandrill.model.MandrillRequestWithDomain in project Java-Mandrill-Wrapper by cribbstechnologies.

the class MandrillUsersRequestTest method testDisableSender.

@Test
public void testDisableSender() throws RequestFailedException {
    usersRequest.setRequest(request);
    MandrillRequestWithDomain disableRequest = new MandrillRequestWithDomain();
    DisableResponse response = new DisableResponse();
    Mockito.when(request.postRequest(disableRequest, ServiceMethods.Users.DISABLE_SENDER, DisableResponse.class)).thenReturn(response);
    usersRequest.disableSender(disableRequest);
    Mockito.verify(request).postRequest(disableRequest, ServiceMethods.Users.DISABLE_SENDER, DisableResponse.class);
}
Also used : MandrillRequestWithDomain(com.cribbstechnologies.clients.mandrill.model.MandrillRequestWithDomain) DisableResponse(com.cribbstechnologies.clients.mandrill.model.response.users.DisableResponse) Test(org.junit.Test)

Example 3 with MandrillRequestWithDomain

use of com.cribbstechnologies.clients.mandrill.model.MandrillRequestWithDomain in project Java-Mandrill-Wrapper by cribbstechnologies.

the class UsersTest method testDisableSender.

@Test
public void testDisableSender() {
    MandrillRequestWithDomain domainRequest = new MandrillRequestWithDomain();
    domainRequest.setDomain("google.com");
    try {
        DisableResponse response = usersRequest.disableSender(domainRequest);
    } catch (RequestFailedException e) {
        e.printStackTrace();
        fail(e.getMessage());
    }
}
Also used : RequestFailedException(com.cribbstechnologies.clients.mandrill.exception.RequestFailedException) MandrillRequestWithDomain(com.cribbstechnologies.clients.mandrill.model.MandrillRequestWithDomain) DisableResponse(com.cribbstechnologies.clients.mandrill.model.response.users.DisableResponse) Test(org.junit.Test)

Aggregations

MandrillRequestWithDomain (com.cribbstechnologies.clients.mandrill.model.MandrillRequestWithDomain)3 Test (org.junit.Test)3 DisableResponse (com.cribbstechnologies.clients.mandrill.model.response.users.DisableResponse)2 RequestFailedException (com.cribbstechnologies.clients.mandrill.exception.RequestFailedException)1