Merge branch 'develop' of https://github.com/SemvdH/Next-Location into develop

This commit is contained in:
RemoMeijer
2021-01-06 21:04:06 +01:00
2 changed files with 11 additions and 2 deletions

View File

@@ -74,9 +74,9 @@ public class Route implements Parcelable {
return this.imageURL; return this.imageURL;
} }
public int calculateTotalTimeMinutes() { public double calculateTotalTimeMinutes() {
// 5 km / h walking speed // 5 km / h walking speed
return (int) ((totalDistance / 1000) / 5) * 60; return ((totalDistance / 1000) / 5) * 60;
} }

View File

@@ -99,4 +99,13 @@ public class RouteTest {
assertNotEquals(expected, route.getDescription()); assertNotEquals(expected, route.getDescription());
} }
@Test
public void testCalculate(){
route.setTotalDistance(18000);
int expected = 216;
System.out.println(route.getTotalDistance());
System.out.println(route.calculateTotalTimeMinutes());
assertEquals(expected, route.calculateTotalTimeMinutes(), 0.01);
}
} }