@Test
public void testFindNotifications() throws Exception {

    new Expectations() {
        {
            mockCtx.getConfig();
            times = 3;
            result = mockNotifierConfig;
            mockNotifierConfig.getClassName();
            times = 1;
            result = "Test";
            mockNotifierConfig.getJarPath();
            times = 1;
            result = "/tmp/test.jar";
            mockProxyUtil.loadClassFromJar("/tmp/test.jar", "Test");
            result = mockNotifier;
        }
    };
    notificationService.register("test_notifier", mockCtx);
    QueryParam qp1 = new QueryParam("one", "1");
    QueryParam qp2 = new QueryParam("two", "2");
    QueryParam qp3 = new QueryParam("numRows", "5");
    notificationService.findNotifications(Arrays.asList(qp1, qp2, qp3));
    new Verifications() {
        {
            Criteria<Notification> criteria;
            mockNotificationStore.findEntities(criteria = withCapture());
            //System.out.println("criteria = " + criteria);
            assertEquals(criteria.clazz(), Notification.class);
            assertEquals(criteria.numRows(), 5);
            assertEquals(criteria.fieldRestrictions().size(), 2);
            assertEquals(criteria.fieldRestrictions().get(0).getValue(), "1");
            assertEquals(criteria.fieldRestrictions().get(1).getValue(), "2");
        }
    };
    notificationService.findNotifications(Arrays.asList(qp1, qp2));
    new Verifications() {
        {
            Criteria<Notification> criteria;
            mockNotificationStore.findEntities(criteria = withCapture());
            //System.out.println("criteria = " + criteria);
            assertEquals(criteria.clazz(), Notification.class);
            assertEquals(0, criteria.numRows());
            assertEquals(criteria.fieldRestrictions().size(), 2);
            assertEquals(criteria.fieldRestrictions().get(0).getValue(), "1");
            assertEquals(criteria.fieldRestrictions().get(1).getValue(), "2");
        }
    };
}