@Test public void shouldAddAndRetrieveLogsBySubjectAndParameter() { Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put("key1", "value1"); parameters.put("key2", "value2"); CouchEventLog couchLog = new CouchEventLog(); couchLog.setSubject("org.motechproject.test"); couchLog.setParameters(parameters); CouchEventLog couchLog2 = new CouchEventLog(); couchLog2.setSubject("org.motechproject.test2"); couchLog2.setParameters(parameters); allCouchLogs.log(couchLog); allCouchLogs.log(couchLog2); List<CouchEventLog> logList = allCouchLogs.findAllBySubjectAndParameter("org.motechproject.test", "key1", "value1"); assertEquals( asList("org.motechproject.test"), extract(logList, on(CouchEventLog.class).getSubject())); logList = allCouchLogs.findAllBySubjectAndParameter("org.motechproject.test2", "key1", "value1"); assertEquals( asList("org.motechproject.test2"), extract(logList, on(CouchEventLog.class).getSubject())); }
@Test public void shouldAddAndRetrieveLogsBySubject() { CouchEventLog couchLog = new CouchEventLog(); couchLog.setSubject("org.motechproject.test"); CouchEventLog couchLog2 = new CouchEventLog(); couchLog2.setSubject("org.motechproject.test2"); allCouchLogs.log(couchLog); allCouchLogs.log(couchLog2); List<CouchEventLog> logList = allCouchLogs.findAllBySubject("org.motechproject.test"); assertEquals( asList("org.motechproject.test"), extract(logList, on(CouchEventLog.class).getSubject())); logList = allCouchLogs.findAllBySubject("org.motechproject.test2"); assertEquals( asList("org.motechproject.test2"), extract(logList, on(CouchEventLog.class).getSubject())); ; }