@@ -0,0 +1,2155 @@
+package de.stephanlindauer.criticalmaps.model;%0A%0Aimport org.json.JSONException;%0Aimport org.junit.Test;%0Aimport org.osmdroid.util.GeoPoint;%0A%0Aimport java.util.Date;%0A%0Aimport static com.google.common.truth.Truth.assertThat;%0A%0Apublic class OwnLocationModelTest %7B%0A    @Test%0A    public void hasPreciseLocation_impreciseLocationIsReportedAsImprecise() throws Exception %7B%0A        OwnLocationModel tested = new OwnLocationModel();%0A%0A        tested.setLocation(new GeoPoint(0d, 0d), 50.0f, 0L);%0A%0A        assertThat(tested.hasPreciseLocation()).isFalse();%0A    %7D%0A%0A    @Test%0A    public void hasPreciseLocation_preciseLocationIsReportedAsPrecise() %7B%0A        OwnLocationModel tested = new OwnLocationModel();%0A%0A        tested.setLocation(new GeoPoint(0d, 0d), 49.9f, 0L);%0A%0A        assertThat(tested.hasPreciseLocation()).isTrue();%0A    %7D%0A%0A    @Test(expected = NullPointerException.class)%0A    public void getLocationJson_throwsWhenNoLocation() %7B%0A        // TODO use JUnit's assertThrows() instead when 4.13 is out%0A        OwnLocationModel tested = new OwnLocationModel();%0A        tested.getLocationJson();%0A    %7D%0A%0A    @Test%0A    public void getLocationJson_returnsCorrectJson() throws JSONException%7B%0A        OwnLocationModel tested = new OwnLocationModel();%0A%0A        String expected = %22%7B%5C%22latitude%5C%22:%5C%2240741895%5C%22,%5C%22longitude%5C%22:%5C%22-73989308%5C%22%7D%22;%0A        tested.setLocation(new GeoPoint(40.741895d, -73.989308d), 1.1f, 0L);%0A        assertThat(tested.getLocationJson().toString()).isEqualTo(expected);%0A    %7D%0A%0A    @Test%0A    public void isLocationFresh_oldLocationReturnsFalse() %7B%0A        OwnLocationModel tested = new OwnLocationModel();%0A        long timestamp = new Date().getTime() - OwnLocationModel.MAX_LOCATION_AGE - 1000;%0A%0A        tested.setLocation(new GeoPoint(54.321d, 43.210d), 1.1f, timestamp);%0A%0A        assertThat(tested.isLocationFresh()).isFalse();%0A    %7D%0A%0A    @Test%0A    public void isLocationFresh_newLocationReturnsTrue() %7B%0A        OwnLocationModel tested = new OwnLocationModel();%0A        long timestamp = new Date().getTime();%0A%0A        tested.setLocation(new GeoPoint(54.321d, 43.210d), 1.1f, timestamp);%0A%0A        assertThat(tested.isLocationFresh()).isTrue();%0A    %7D%0A%7D

add unittests