r29 - trunk/src/test/java/org/nuiton/mapstoragemanager/plugins/bighashmap
Author: dlanglais Date: 2010-01-28 01:35:08 +0100 (Thu, 28 Jan 2010) New Revision: 29 Added: trunk/src/test/java/org/nuiton/mapstoragemanager/plugins/bighashmap/RowTest.java Log: ... Oubli de commit le fichier RowTest ... Added: trunk/src/test/java/org/nuiton/mapstoragemanager/plugins/bighashmap/RowTest.java =================================================================== --- trunk/src/test/java/org/nuiton/mapstoragemanager/plugins/bighashmap/RowTest.java (rev 0) +++ trunk/src/test/java/org/nuiton/mapstoragemanager/plugins/bighashmap/RowTest.java 2010-01-28 00:35:08 UTC (rev 29) @@ -0,0 +1,150 @@ +package org.nuiton.mapstoragemanager.plugins.bighashmap; + +import java.util.HashMap; +import java.util.Map; +import junit.framework.TestCase; + +public class RowTest extends TestCase { + + Structure structure; + Map<String,Object> content; + Row r; + + public void testToString() { + { + structure = new StructureImpl(); + content = new HashMap<String, Object>(); + r = new RowImpl(structure, content); + + assertEquals(r.toString(), content.values().toString()); + } + + { + structure = new StructureImpl(); + structure.addColumn("Test", String.class); + content = new HashMap<String, Object>(); + content.put("Test", "StringDeTest"); + r = new RowImpl(structure, content); + + assertEquals(r.toString(), content.values().toString()); + } + + { + structure = new StructureImpl(); + structure.addColumn("Test1", String.class); + structure.addColumn("Test2", Integer.class); + structure.addColumn("Test3", Double.class); + content = new HashMap<String, Object>(); + content.put("Test1", "StringDeTest"); + content.put("Test2", new Integer(1)); + content.put("Test3", new Double(0.07)); + r = new RowImpl(structure, content); + + assertEquals(r.toString(), content.values().toString()); + } + } + + public void testGetRowContent() { + { + structure = new StructureImpl(); + content = new HashMap<String, Object>(); + r = new RowImpl(structure, content); + + assertEquals(r.getRowContent(), content); + } + + { + structure = new StructureImpl(); + structure.addColumn("Test", String.class); + content = new HashMap<String, Object>(); + content.put("Test", "StringDeTest"); + r = new RowImpl(structure, content); + + assertEquals(r.getRowContent(), content); + } + + { + structure = new StructureImpl(); + structure.addColumn("Test1", String.class); + structure.addColumn("Test2", Integer.class); + structure.addColumn("Test3", Double.class); + content = new HashMap<String, Object>(); + content.put("Test1", "StringDeTest"); + content.put("Test2", new Integer(1)); + content.put("Test3", new Double(0.07)); + r = new RowImpl(structure, content); + + assertEquals(r.getRowContent(), content); + } + } + + public void testGetRowStructure() { + { + structure = new StructureImpl(); + content = new HashMap<String, Object>(); + r = new RowImpl(structure, content); + + assertEquals(r.getRowStructure(), structure); + } + + { + structure = new StructureImpl(); + structure.addColumn("Test", String.class); + content = new HashMap<String, Object>(); + content.put("Test", "StringDeTest"); + r = new RowImpl(structure, content); + + assertEquals(r.getRowStructure(), structure); + } + + { + structure = new StructureImpl(); + structure.addColumn("Test1", String.class); + structure.addColumn("Test2", Integer.class); + structure.addColumn("Test3", Double.class); + content = new HashMap<String, Object>(); + content.put("Test1", "StringDeTest"); + content.put("Test2", new Integer(1)); + content.put("Test3", new Double(0.07)); + r = new RowImpl(structure, content); + + assertEquals(r.getRowStructure(), structure); + } + } + + public void testGetContent() { + { + structure = new StructureImpl(); + content = new HashMap<String, Object>(); + r = new RowImpl(structure, content); + + assertEquals(r.getContent(""), null); + } + + { + structure = new StructureImpl(); + structure.addColumn("Test", String.class); + content = new HashMap<String, Object>(); + content.put("Test", "StringDeTest"); + r = new RowImpl(structure, content); + + assertEquals(r.getContent("Test"), "StringDeTest"); + } + + { + structure = new StructureImpl(); + structure.addColumn("Test1", String.class); + structure.addColumn("Test2", Integer.class); + structure.addColumn("Test3", Double.class); + content = new HashMap<String, Object>(); + content.put("Test1", "StringDeTest"); + content.put("Test2", new Integer(1)); + content.put("Test3", new Double(0.07)); + r = new RowImpl(structure, content); + + assertEquals(r.getContent("Test1"), "StringDeTest"); + assertEquals(r.getContent("Test2"), new Integer(1)); + assertEquals(r.getContent("Test3"), new Double(0.07)); + } + } +}
participants (1)
-
dlanglais@users.nuiton.org