hehe
This commit is contained in:
@@ -20,29 +20,53 @@ public class DataTest {
|
||||
|
||||
@Test
|
||||
public void testDistance(){
|
||||
try {
|
||||
data.addDistance(2356.234);
|
||||
} catch (NullPointerException e) {
|
||||
System.out.println("shared preferences not mocked");
|
||||
}
|
||||
double expected = 2356.234;
|
||||
assertEquals(expected, data.getDistanceTraveled(), 0.01);
|
||||
data.addDistance(234342.1);
|
||||
try {
|
||||
data.addDistance(2356.234);
|
||||
} catch (NullPointerException e) {
|
||||
System.out.println("shared preferences not mocked");
|
||||
}
|
||||
assertNotEquals(expected, data.getDistanceTraveled());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTimeWalked(){
|
||||
try {
|
||||
data.addTimeWalked(3456);
|
||||
} catch (NullPointerException e) {
|
||||
System.out.println("shared preferences not mocked");
|
||||
}
|
||||
long expected = 3456;
|
||||
assertEquals(expected, data.getTotalTime());
|
||||
data.addTimeWalked(3445);
|
||||
try {
|
||||
data.addTimeWalked(3456);
|
||||
} catch (NullPointerException e) {
|
||||
System.out.println("shared preferences not mocked");
|
||||
}
|
||||
assertNotEquals(expected, data.getTotalTime());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testVisitedLocation(){
|
||||
Location testLocation = new Location("test", "test", "test", "test");
|
||||
try {
|
||||
data.visitLocation(testLocation);
|
||||
} catch (NullPointerException e) {
|
||||
System.out.println("shared preferences not mocked");
|
||||
}
|
||||
int expected = 1;
|
||||
assertEquals(expected, data.getLocationsVisited());
|
||||
try {
|
||||
data.visitLocation(new Location("TESTFORFALSE", "TESTFORFALSE", "TESTFORFALSE", "TESTFORFALSE"));
|
||||
} catch (NullPointerException e) {
|
||||
System.out.println("shared preferences not mocked");
|
||||
}
|
||||
assertNotEquals(expected, data.getLocationsVisited());
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.a1.nextlocation;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import com.a1.nextlocation.data.Route;
|
||||
import com.a1.nextlocation.data.RouteHandler;
|
||||
|
||||
@@ -50,7 +52,11 @@ public class RouteHandlerTest {
|
||||
assertEquals(expected, routeHandler.isFollowingRoute());
|
||||
assertEquals(testRoute, routeHandler.getCurrentRoute());
|
||||
|
||||
try {
|
||||
routeHandler.finishRoute();
|
||||
} catch (NullPointerException e) {
|
||||
System.out.println("shared preferences not mocked");
|
||||
}
|
||||
assertNull(routeHandler.getCurrentRoute());
|
||||
|
||||
routeHandler.followRoute(new Route("FALSEROUTENAME"));
|
||||
|
||||
Reference in New Issue
Block a user