@@ -0,0 +1,2858 @@
+/*%0A * Copyright 2015 Adam Speakman%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A *     http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0A%0Apackage speakman.whatsshakingnz.utils;%0A%0Aimport android.test.AndroidTestCase;%0A%0Aimport com.google.android.gms.maps.model.LatLng;%0A%0Aimport speakman.whatsshakingnz.model.LocalPlace;%0A%0A/**%0A * Created by Adam on 11/24/2015.%0A */%0Apublic class DistanceUtilTests extends AndroidTestCase %7B%0A%0A    public void testClosestPlaceIsCorrect() %7B%0A        LocalPlace closestPlace = DistanceUtil.getClosestPlace(new LatLng(-36.806, 174.814));%0A        assertEquals(%22Auckland%22, closestPlace.name);%0A%0A        closestPlace = DistanceUtil.getClosestPlace(new LatLng(-35.778, 174.217));%0A        assertEquals(%22Whangarei%22, closestPlace.name);%0A%0A        closestPlace = DistanceUtil.getClosestPlace(new LatLng(-43.584, 172.65));%0A        assertEquals(%22Christchurch%22, closestPlace.name);%0A    %7D%0A%0A    public void testDirectionIsCorrect() %7B%0A        LatLng center = new LatLng(-37, 170);%0A        LatLng north = new LatLng(-36, 170);%0A        LatLng northEast = new LatLng(-36, 171);%0A        LatLng east = new LatLng(-37, 171);%0A        LatLng southEast = new LatLng(-38, 171);%0A        LatLng south = new LatLng(-38, 170);%0A        LatLng southWest = new LatLng(-38, 169);%0A        LatLng west = new LatLng(-37, 169);%0A        LatLng northWest = new LatLng(-36, 169);%0A%0A        assertEquals(DistanceUtil.Direction.North, DistanceUtil.getDirection(center, north));%0A        assertEquals(DistanceUtil.Direction.NorthEast, DistanceUtil.getDirection(center, northEast));%0A        assertEquals(DistanceUtil.Direction.East, DistanceUtil.getDirection(center, east));%0A        assertEquals(DistanceUtil.Direction.SouthEast, DistanceUtil.getDirection(center, southEast));%0A        assertEquals(DistanceUtil.Direction.South, DistanceUtil.getDirection(center, south));%0A        assertEquals(DistanceUtil.Direction.SouthWest, DistanceUtil.getDirection(center, southWest));%0A        assertEquals(DistanceUtil.Direction.West, DistanceUtil.getDirection(center, west));%0A        assertEquals(DistanceUtil.Direction.NorthWest, DistanceUtil.getDirection(center, northWest));%0A    %7D%0A%0A    public void testDirectionIsCorrectAroundAntimeridian() %7B%0A        LatLng center = new LatLng(-37, 179);%0A        LatLng east = new LatLng(-37, -179);%0A%0A        assertEquals(DistanceUtil.Direction.East, DistanceUtil.getDirection(center, east));%0A    %7D%0A%7D%0A

Add unit tests for DistanceUtil class