changeset 123:372b9666622d

Add missing MongoStorage test reviewed-by: omajid, rkennke review-thread: http://icedtea.classpath.org/pipermail/thermostat/2012-March/000356.html
author Jon VanAlten <jon.vanalten@redhat.com>
date Tue, 20 Mar 2012 18:06:13 -0400
parents 41916eee30cc
children a5c415a6100d
files common/src/test/java/com/redhat/thermostat/common/storage/MongoStorageTest.java
diffstat 1 files changed, 17 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/common/src/test/java/com/redhat/thermostat/common/storage/MongoStorageTest.java	Tue Mar 20 22:51:54 2012 +0100
+++ b/common/src/test/java/com/redhat/thermostat/common/storage/MongoStorageTest.java	Tue Mar 20 18:06:13 2012 -0400
@@ -204,10 +204,27 @@
     }
 
     @Test
+    public void verifyFindReturnsCorrectChunk() {
+
+        // TODO find a way to test this that isn't just testing mock and converters
+        Chunk query = new Chunk(testCategory, false);
+        // Because we mock the DBCollection, the contents of this query don't actually determine the result.
+        query.put(key5, "test1");
+
+        Chunk result = storage.find(query);
+
+        assertNotNull(result);
+        assertArrayEquals(new Key<?>[]{key1, key2}, result.getKeys().toArray());
+        assertEquals("test1", result.get(key1));
+        assertEquals("test2", result.get(key2));
+    }
+
+    @Test
     public void verifyFindAllReturnsCorrectCursor() {
 
         // TODO find a way to test this that isn't just testing MongoCursor
         Chunk query = new Chunk(testCategory, false);
+        // Because we mock the DBCollection, the contents of this query don't actually determine the result.
         query.put(key5, "test1");
 
         Cursor cursor = storage.findAll(query);