コード例 #1
0
 @Test
 public void testDeleteRoute() {
   int initCount = RouteDatabaseHelper.getRoutesCount();
   testRoutes.remove(testRoute3);
   test_dbh.deleteRoute(testRoute3);
   assertEquals(initCount - 1, RouteDatabaseHelper.getRoutesCount());
 }
コード例 #2
0
  @Test
  public void testGetAllRoutes() {
    ArrayList<Route> routes = test_dbh.getAllRoutes();

    assertEquals(testRoute1.getId(), routes.get(0).getId());
    assertEquals(testRoute2.getId(), routes.get(1).getId());
    // assertEquals(testRoute3.getId(), routes.get(2).getId());
  }
コード例 #3
0
  @Before
  public void setUp() throws Exception {
    RenamingDelegatingContext context = new RenamingDelegatingContext(getContext(), "test_");
    test_dbh = RouteDatabaseHelper.getInstance(context);

    testRoute1 = new Route(1, "Haley", "Shelby");
    testRoute2 = new Route(2, "Shelby", "Haley");
    testRoute3 = new Route(3, "BFE", "Jordan-Hare");

    test_dbh.addRoute(testRoute1);
    test_dbh.addRoute(testRoute2);
    // test_dbh.addRoute(testRoute3);

    testRoutes = new ArrayList<Route>();
    testRoutes.add(testRoute1);
    testRoutes.add(testRoute2);
    testRoutes.add(testRoute3);
  }
コード例 #4
0
 @Test
 public void testUpdateRoute() {
   Route newRoute1 = new Route(1, "Lowder", "Shelby");
   assertEquals(7, test_dbh.updateRoute(newRoute1)); // 6 if run as a single test
   assertEquals(newRoute1.getFrom(), test_dbh.getRoute(1).getFrom());
 }
コード例 #5
0
 @Test
 public void testGetRoutesCount() {
   assertEquals(12, RouteDatabaseHelper.getRoutesCount()); // 10 if run as a single test
 }
コード例 #6
0
 @Test
 public void testGetRoute() {
   Route route = test_dbh.getRoute(1);
   assertEquals(testRoute1.getId(), route.getId());
 }
コード例 #7
0
 @Test
 public void testAddRoute() {
   test_dbh.addRoute(testRoute3);
   assertEquals(3, RouteDatabaseHelper.getRoutesCount());
 }
コード例 #8
0
 @After
 public void tearDown() throws Exception {
   test_dbh.close();
   testRoutes.clear();
   super.tearDown();
 }