/** * Tear down the test fixture by calling {@link Activity#finish()} and deleting the app's * database. * * @throws Exception If an error occurs while chaining to the super class. */ @Override public void tearDown() throws Exception { DatabaseUtil dbUtil = new DatabaseUtil(this.inst.getTargetContext()); dbUtil.clearDatabase(); super.tearDown(); }
/** * Test that baseball card data for multiple cards is correctly added to the database when it is * entered into the {@link BaseballCardDetails} activity. This test enters all data using a single * invocation of the {@link BaseballCardDetails} activity. * * @throws Throwable If an error occurs while the portion of the test on the UI thread runs. */ public void testAddMultipleCards() throws Throwable { for (BaseballCard nextCard : this.allCards) { BBCTTestUtil.addCard(this.solo, nextCard); BBCTTestUtil.waitForToast(this.solo, BBCTTestUtil.ADD_MESSAGE); } DatabaseUtil dbUtil = new DatabaseUtil(this.inst.getTargetContext()); for (BaseballCard nextCard : this.allCards) { Assert.assertTrue("Missing card: " + nextCard, dbUtil.containsBaseballCard(nextCard)); } }
/** * Test that baseball card data is correctly added to the database when it is entered into the * {@link BaseballCardDetails} activity. * * @throws Throwable If an error occurs while the portion of the test on the UI thread runs. */ public void testAddCard() throws Throwable { BBCTTestUtil.addCard(this.solo, this.card); BBCTTestUtil.waitForToast(this.solo, BBCTTestUtil.ADD_MESSAGE); DatabaseUtil dbUtil = new DatabaseUtil(this.inst.getTargetContext()); Assert.assertTrue("Missing card: " + this.card, dbUtil.containsBaseballCard(this.card)); }