/** * Sends a jsonobject to the method and checks that it can parse it correctly * * @throws JSONException */ public void testParseJsonAndDraw() throws JSONException { String jsonresponse = "{\"result\":[{\"time\":\"2012-10-10 12:48:11\",\"name\":\"Arne\",\"lat\":\"57685535\",\"lng\":\"11977898\"},{\"time\":\"2012-10-10 12:48:41\",\"name\":\"Anna\",\"lat\":\"57685534\",\"lng\":\"11977897\"},{\"time\":\"2012-10-10 12:57:36\",\"name\":\"Kalle\",\"lat\":\"57685533\",\"lng\":\"11977896\"}]}"; JSONObject jsonobject = new JSONObject(jsonresponse); activity.parseJsonAndDraw(jsonobject); assertEquals(SIZEOFJSONARRAY, activity.getSizeOfJsonArray()); }
/** Is testing that is testing that the regex is working Only allowing letters and numbers */ public void testAddNameRegex() { TouchUtils.tapView(this, this.nameEdit); super.sendKeys("R U N E "); super.getInstrumentation().waitForIdleSync(); super.sendKeys(KeyEvent.KEYCODE_APOSTROPHE); super.getInstrumentation().waitForIdleSync(); TouchUtils.clickView(this, this.checkInButton); super.getInstrumentation().waitForIdleSync(); activity.getInputName(); assertEquals("rune", activity.getInputName()); }
/** Method called after each test to safely close them down. */ protected void tearDown() throws Exception { // TODO Auto-generated method stub activity.finish(); super.tearDown(); }
/** Tests conditions before starting to tests */ public void testPreConditions() { assertEquals(CheckInActivity.class, activity.getClass()); assertEquals(Button.class, checkInButton.getClass()); assertEquals(MapView.class, mapview.getClass()); assertEquals(EditText.class, nameEdit.getClass()); }
/** * Tests that the database is connected and that a response from the database is recieved If the * jsonobject is received the boolean running is set to true */ public void testConnectionToDatabase() { activity.connectExternalDatabase(); assertEquals(true, activity.getIsAsyncTaskRunning()); }