Search in sources :

Example 1 with DisableResponse

use of com.cribbstechnologies.clients.mandrill.model.response.users.DisableResponse in project Java-Mandrill-Wrapper by cribbstechnologies.

the class MandrillRESTRequestTest method testDisableResponseConversion.

@Test
public void testDisableResponseConversion() throws IOException {
    this.initRequestWithActualMapper();
    StringWriter sw = new StringWriter();
    IOUtils.copy(this.getClass().getClassLoader().getResourceAsStream("users/disableSenderResponse.txt"), sw);
    DisableResponse response = (DisableResponse) this.request.convertResponseData(sw.toString(), DisableResponse.class);
    assertEquals("example domain", response.getDomain());
    assertEquals("example created_at", response.getCreated_at());
    assertEquals("example approved_at", response.getApproved_at());
    assertTrue(response.isIs_enabled());
}
Also used : StringWriter(java.io.StringWriter) DisableResponse(com.cribbstechnologies.clients.mandrill.model.response.users.DisableResponse) Test(org.junit.Test)

Example 2 with DisableResponse

use of com.cribbstechnologies.clients.mandrill.model.response.users.DisableResponse 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 DisableResponse

use of com.cribbstechnologies.clients.mandrill.model.response.users.DisableResponse in project Java-Mandrill-Wrapper by cribbstechnologies.

the class MandrillRESTRequestTest method testVerifySenderResponseConversion.

@Test
public void testVerifySenderResponseConversion() throws IOException {
    this.initRequestWithActualMapper();
    StringWriter sw = new StringWriter();
    IOUtils.copy(this.getClass().getClassLoader().getResourceAsStream("users/verifySenderResponse.txt"), sw);
    DisableResponse response = (DisableResponse) this.request.convertResponseData(sw.toString(), DisableResponse.class);
    assertEquals("example domain", response.getDomain());
    assertEquals("example created_at", response.getCreated_at());
    assertEquals("example approved_at", response.getApproved_at());
    assertTrue(response.isIs_enabled());
}
Also used : StringWriter(java.io.StringWriter) DisableResponse(com.cribbstechnologies.clients.mandrill.model.response.users.DisableResponse) Test(org.junit.Test)

Example 4 with DisableResponse

use of com.cribbstechnologies.clients.mandrill.model.response.users.DisableResponse 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

DisableResponse (com.cribbstechnologies.clients.mandrill.model.response.users.DisableResponse)4 Test (org.junit.Test)4 MandrillRequestWithDomain (com.cribbstechnologies.clients.mandrill.model.MandrillRequestWithDomain)2 StringWriter (java.io.StringWriter)2 RequestFailedException (com.cribbstechnologies.clients.mandrill.exception.RequestFailedException)1