X-Git-Url: http://jaekl.net/gitweb/?p=cfb.git;a=blobdiff_plain;f=test%2Fnet%2Fjaekl%2Fcfb%2Fstore%2FDbStoreTest.java;fp=test%2Fnet%2Fjaekl%2Fcfb%2Fstore%2FDbStoreTest.java;h=5c66c225fd38107d7e866d826bf43be269a68616;hp=f269a9cd126205bfe0a0dc2db63ff9a99fc37536;hb=a1378c84c773511e4ffe99fb419da67af188aff7;hpb=a59aa887766f250ba0ad0948c54e1a8d9a590a23 diff --git a/test/net/jaekl/cfb/store/DbStoreTest.java b/test/net/jaekl/cfb/store/DbStoreTest.java index f269a9c..5c66c22 100644 --- a/test/net/jaekl/cfb/store/DbStoreTest.java +++ b/test/net/jaekl/cfb/store/DbStoreTest.java @@ -137,7 +137,7 @@ public class DbStoreTest { } @Test - public void testGetPrior_withNoEntries() throws SQLException, TypeMismatchException { + public void testGetPrior_withNoEntries() throws SQLException, TypeMismatchException, StoreException { // First test: getPrior(null) should return null Analysis actual = m_store.getPrior(null); assertNull(actual); @@ -236,75 +236,42 @@ public class DbStoreTest { assertEquals(firstAnalysis.getEnd(), priorAnalysis.getEnd()); assertEquals(firstAnalysis.getBugCollection(), priorAnalysis.getBugCollection()); } -/* - @Test - public void testGetBugType() { - fail("Not yet implemented"); - } - - @Test - public void testGetCategoryName() { - fail("Not yet implemented"); - } - - @Test - public void testGetLoc() { - fail("Not yet implemented"); - } - - @Test - public void testGetLocId() { - fail("Not yet implemented"); - } - - @Test - public void testFindLocId() { - fail("Not yet implemented"); - } - - @Test - public void testStoreLoc() { - fail("Not yet implemented"); - } @Test - public void testGetVarIdBugInstance() { - fail("Not yet implemented"); + public void testGetLocId_nullReturnsNull() throws SQLException, TypeMismatchException { + Long locId = m_store.getLocId(null); + assertNull(locId); } @Test - public void testGetVar() { - fail("Not yet implemented"); - } - - @Test - public void testGetVarIdLocalVariable() { - fail("Not yet implemented"); - } - - @Test - public void testFindVarId() { - fail("Not yet implemented"); - } - - @Test - public void testStoreVar() { - fail("Not yet implemented"); - } - - @Test - public void testGetPriorId() { - fail("Not yet implemented"); + public void testGetLocId_notFoundIsStored() throws SQLException, TypeMismatchException { + Location loc = new Location(1234567890L, + "ThisClassDoesNotExist", + "thisMethodDoesNotExist", + "INVALID_METHOD_ROLE", + 0, 90909); + Long locId = m_store.getLocId(loc); + assertNotNull(locId); + assertTrue(locId.longValue() > 0); + + Long secondLocId = m_store.getLocId(loc); + assertEquals(locId, secondLocId); } @Test - public void testGetAnalysis() { - fail("Not yet implemented"); + public void testGetLoc_nullReturnsNull() throws SQLException, TypeMismatchException, StoreException { + Location loc = m_store.getLoc(null); + assertNull(loc); } - + @Test - public void testGetBugCollection() { - fail("Not yet implemented"); + public void testGetLoc_invalidId() throws SQLException, TypeMismatchException { + try { + m_store.getLoc(Long.valueOf(-3)); + fail("Should have thrown a StoreException"); + } + catch (StoreException exc) { + assertEquals(StoreException.Type.INVALID_LOC_ID, exc.getType()); + } } -*/ }