Further unit tests: getVarId()
[cfb.git] / test / net / jaekl / cfb / store / DbStoreTest.java
index 98656c81872c42af2a7a6466e5be6021d4ecc4c9..9c6c1175c0b56098d4544901201d87bb59936db4 100644 (file)
@@ -292,4 +292,16 @@ public class DbStoreTest {
                        assertEquals(StoreException.Type.INVALID_VAR_ID, exc.getType());
                }
        }
+
+       @Test
+       public void testGetVarId_notFoundIsStored() throws SQLException, TypeMismatchException {
+               LocalVariable var = new LocalVariable(2345678901L, "VariableNameDoesNotYetExist", "VARIABLE_READ");
+
+               Long varId = m_store.getVarId(var);
+               assertNotNull(varId);
+               assertTrue(varId.longValue() > 0);
+               
+               Long secondVarId = m_store.getVarId(var);
+               assertEquals(varId, secondVarId);
+       }
 }