}
@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);
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());
+ }
}
-*/
}