@Test public void testClear() throws PersistenceException { QueryArgumentMatcher<Void, Context> queryArgumentMatcher = QueryArgumentMatcher.valueOf(ClearQuery.class); EasyMock.expect(this.dataStoreMock.execute(queryArgumentMatcher.match())).andReturn(null); EasyMock.replay(this.dataStoreMock); this.objectStore.clear(); EasyMock.verify(this.dataStoreMock); }
@Test public void testSize() throws PersistenceException { QueryArgumentMatcher<Long, Context> queryArgumentMatcher = QueryArgumentMatcher.valueOf(SizeQuery.class); long expected = 1; EasyMock.expect(this.dataStoreMock.execute(queryArgumentMatcher.match())) .andReturn(Long.valueOf(expected)); EasyMock.replay(this.dataStoreMock); Assert.assertEquals(expected, this.objectStore.size()); EasyMock.verify(this.dataStoreMock); }
@Test public void testGetAll() throws PersistenceException { QueryArgumentMatcher<Collection<IdentifiableObj>, Context> queryArgumentMatcher = QueryArgumentMatcher.valueOf(GetAllQuery.class); @SuppressWarnings("unchecked") Collection<IdentifiableObj> expected = EasyMock.createMock(Collection.class); EasyMock.expect(this.dataStoreMock.execute(queryArgumentMatcher.match())).andReturn(expected); EasyMock.replay(this.dataStoreMock); Assert.assertEquals(expected, this.objectStore.getAll()); EasyMock.verify(this.dataStoreMock); }