Search in sources :

Example 1 with EntityNotFoundException

use of com.hortonworks.streamline.common.exception.service.exception.request.EntityNotFoundException in project streamline by hortonworks.

the class NotificationsResourceTest method testListNotifications.

@Test
public void testListNotifications() throws Exception {
    final MultivaluedMap<String, String> qp = new MultivaluedHashMap<String, String>() {

        {
            putSingle("status", "DELIVERED");
            putSingle("notifierName", "console_notifier");
            putSingle("startTs", "1444625166800");
            putSingle("endTs", "1444625166810");
        }
    };
    new Expectations() {

        {
            mockUriInfo.getQueryParameters();
            times = 1;
            result = qp;
        }
    };
    try {
        resource.listNotifications(mockUriInfo, securityContext);
        fail("We don't mock the result so it should throw entity not found");
    } catch (EntityNotFoundException e) {
        // expected
        new Verifications() {

            {
                List<QueryParam> qps;
                mockNotificationService.findNotifications(qps = withCapture());
                // System.out.println(qps);
                assertEquals(4, qps.size());
            }
        };
    }
}
Also used : MultivaluedHashMap(javax.ws.rs.core.MultivaluedHashMap) Expectations(mockit.Expectations) List(java.util.List) EntityNotFoundException(com.hortonworks.streamline.common.exception.service.exception.request.EntityNotFoundException) Verifications(mockit.Verifications) Test(org.junit.Test)

Aggregations

EntityNotFoundException (com.hortonworks.streamline.common.exception.service.exception.request.EntityNotFoundException)1 List (java.util.List)1 MultivaluedHashMap (javax.ws.rs.core.MultivaluedHashMap)1 Expectations (mockit.Expectations)1 Verifications (mockit.Verifications)1 Test (org.junit.Test)1