Search in sources :

Example 1 with CollectionResponse

use of com.hortonworks.streamline.common.CollectionResponse in project streamline by hortonworks.

the class NotifierInfoCatalogResourceTest method testListNotifiers.

@Test
public void testListNotifiers() {
    final Notifier notifier = new Notifier();
    final QueryParam expectedQp = new QueryParam("notifierName", "email_notifier_1");
    multiValuedMap.putSingle("notifierName", "email_notifier_1");
    new Expectations() {

        {
            mockUriInfo.getQueryParameters();
            times = 1;
            result = multiValuedMap;
            mockCatalogService.listNotifierInfos(Arrays.asList(expectedQp));
            times = 1;
            result = Arrays.asList(notifier);
        }
    };
    CollectionResponse collectionResponse = (CollectionResponse) resource.listNotifiers(mockUriInfo, securityContext).getEntity();
    assertEquals(1, collectionResponse.getEntities().size());
    assertEquals(notifier, collectionResponse.getEntities().iterator().next());
}
Also used : Expectations(mockit.Expectations) QueryParam(com.hortonworks.registries.common.QueryParam) CollectionResponse(com.hortonworks.streamline.common.CollectionResponse) Notifier(com.hortonworks.streamline.streams.catalog.Notifier) Test(org.junit.Test)

Aggregations

QueryParam (com.hortonworks.registries.common.QueryParam)1 CollectionResponse (com.hortonworks.streamline.common.CollectionResponse)1 Notifier (com.hortonworks.streamline.streams.catalog.Notifier)1 Expectations (mockit.Expectations)1 Test (org.junit.Test)1