Further unit tests: CFB and Delta
[cfb.git] / test / net / jaekl / cfb / db / driver / DbDriverMock.java
index 86ae18c1785bcbbd454ba425573bdae0eb330a14..927f2768a5bc5b0f32fac9f9aba2afbb0d1c59ad 100644 (file)
@@ -21,16 +21,19 @@ import net.jaekl.cfb.db.Sort;
 import net.jaekl.cfb.db.Table;
 import net.jaekl.cfb.db.TableMock;
 import net.jaekl.cfb.db.TypeMismatchException;
+import net.jaekl.cfb.util.Util;
 
 public class DbDriverMock extends DbDriver {
 
-       private HashMap<String, TableMock> m_tables;
+       private ArrayList<ConnectionMock> m_cons;
        private HashMap<String, SequenceMock> m_sequences;
+       private HashMap<String, TableMock> m_tables;
        
        public DbDriverMock() {
                super();
-               m_tables = new HashMap<String, TableMock>();
+               m_cons = new ArrayList<ConnectionMock>();
                m_sequences = new HashMap<String, SequenceMock>();
+               m_tables = new HashMap<String, TableMock>();
        }
 
        @Override
@@ -42,7 +45,9 @@ public class DbDriverMock extends DbDriver {
        public Connection connect(String host, int port, String dbName, String user, String pass) 
                throws SQLException 
        {
-               return null;
+               ConnectionMock con = new ConnectionMock();
+               m_cons.add(con);
+               return con;
        }
        
        @Override
@@ -194,7 +199,7 @@ public class DbDriverMock extends DbDriver {
                        if (condition.getColumn().equals(col)) {
                                switch(condition.getOperation()) {
                                case EQUAL:
-                                       return (condition.getValue().equals(row.getValue(idx)));
+                                       return Util.objsAreEqual(condition.getValue(), row.getValue(idx));
                                case GREATER_THAN:
                                        return (aLessThanB(condition.getValue(), row.getValue(idx)));
                                case LESS_THAN: