Search in sources :

Example 1 with BaseMandrillRequest

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

the class UsersTest method testPing.

@Test
public void testPing() {
    BaseMandrillRequest baseRequest = new BaseMandrillRequest();
    try {
        BaseMandrillStringResponse response = usersRequest.performPing(baseRequest);
        assertEquals("\"PONG!\"", response.getResponse());
    } catch (RequestFailedException e) {
        fail(e.getMessage());
    }
}
Also used : BaseMandrillStringResponse(com.cribbstechnologies.clients.mandrill.model.response.BaseMandrillStringResponse) RequestFailedException(com.cribbstechnologies.clients.mandrill.exception.RequestFailedException) BaseMandrillRequest(com.cribbstechnologies.clients.mandrill.model.BaseMandrillRequest) Test(org.junit.Test)

Example 2 with BaseMandrillRequest

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

the class MandrillRESTRequestTest method testGetPostDataBaseMandrillRequest.

@Test
public void testGetPostDataBaseMandrillRequest() throws Exception {
    this.initRequestWithActualMapper();
    assertEquals("{\"key\":null}", this.request.getPostData(this.emptyBaseRequest));
    this.mutableBaseRequest = new BaseMandrillRequest();
    this.mutableBaseRequest.setKey("this is my key");
    assertEquals("{\"key\":\"this is my key\"}", this.request.getPostData(this.mutableBaseRequest));
    this.mutableBaseRequest.setKey("this is my key with \"extra\" quotes");
    assertEquals("{\"key\":\"this is my key with \\\"extra\\\" quotes\"}", this.request.getPostData(this.mutableBaseRequest));
}
Also used : BaseMandrillRequest(com.cribbstechnologies.clients.mandrill.model.BaseMandrillRequest) Test(org.junit.Test)

Example 3 with BaseMandrillRequest

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

the class UsersTest method testPing2.

@Test
public void testPing2() {
    BaseMandrillRequest baseRequest = new BaseMandrillRequest();
    try {
        PingResponse pingResponse = usersRequest.performPing2(baseRequest);
        assertEquals("PONG!", pingResponse.getPingResponse());
    } catch (RequestFailedException e) {
        e.printStackTrace();
        fail(e.getMessage());
    }
}
Also used : RequestFailedException(com.cribbstechnologies.clients.mandrill.exception.RequestFailedException) BaseMandrillRequest(com.cribbstechnologies.clients.mandrill.model.BaseMandrillRequest) PingResponse(com.cribbstechnologies.clients.mandrill.model.response.users.PingResponse) Test(org.junit.Test)

Example 4 with BaseMandrillRequest

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

the class MandrillUsersRequestTest method before.

@Before
public void before() {
    initMocks(this);
    bmr = new BaseMandrillRequest();
    bmr.setKey("123");
}
Also used : BaseMandrillRequest(com.cribbstechnologies.clients.mandrill.model.BaseMandrillRequest) Before(org.junit.Before)

Aggregations

BaseMandrillRequest (com.cribbstechnologies.clients.mandrill.model.BaseMandrillRequest)4 Test (org.junit.Test)3 RequestFailedException (com.cribbstechnologies.clients.mandrill.exception.RequestFailedException)2 BaseMandrillStringResponse (com.cribbstechnologies.clients.mandrill.model.response.BaseMandrillStringResponse)1 PingResponse (com.cribbstechnologies.clients.mandrill.model.response.users.PingResponse)1 Before (org.junit.Before)1