/*
 * Copyright (c) 2015 NECTEC
 *   National Electronics and Computer Technology Center, Thailand
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package th.or.nectec.tanrabad.entity;

import org.junit.Test;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;


public class LocationTest {
    private final double latitude1 = 14.078606;
    private final double longitude1 = 100.603120;
    private final Location location1 = new Location(latitude1, longitude1);

    @Test
    public void testGetLatitude()  {
        assertEquals(14.078606, location1.getLatitude(), 0.0001);
    }

    @Test
    public void testGetLongitude()  {
        assertEquals(100.603120, location1.getLongitude(), 0.0001);
    }

    @Test
    public void locationWithDifferentLatitudeMustNotEquals()  {
        Location location2 = new Location(15.078606, longitude1);
        assertNotEquals(location1, location2);
    }

    @Test
    public void locationWithDifferentLongitudeMustNotEquals()  {
        Location location2 = new Location(latitude1, 200.603120);
        assertNotEquals(location1, location2);
    }

    @Test
    public void locationTheSameLatitudeLongitudeMustEquals()  {
        Location location2 = new Location(latitude1, longitude1);
        assertEquals(location1, location2);
    }}
@@ -840,16 +840,64 @@
 nTest %7B%0A
+    public static final double DELTA = 0.0001;%0A%0A
     priv
@@ -1021,17 +1021,16 @@
 location
-1
  = new L
@@ -1130,25 +1130,25 @@
 tEquals(
-14.078606
+latitude1
 , locati
@@ -1145,25 +1145,24 @@
 e1, location
-1
 .getLatitude
@@ -1157,38 +1157,37 @@
 .getLatitude(), 
-0.0001
+DELTA
 );%0A    %7D%0A%0A    @T
@@ -1249,26 +1249,26 @@
 tEquals(
-100.603120
+longitude1
 , locati
@@ -1269,17 +1269,16 @@
 location
-1
 .getLong
@@ -1286,22 +1286,21 @@
 tude(), 
-0.0001
+DELTA
 );%0A    %7D
@@ -1388,33 +1388,39 @@
    Location 
-l
+anotherL
 ocation
-2
  = new Locat
@@ -1439,32 +1439,33 @@
 6, longitude1);%0A
+%0A
         assertNo
@@ -1476,36 +1476,41 @@
 als(location
-1
 , 
-l
+anotherL
 ocation
-2
 );%0A    %7D%0A%0A  
@@ -1595,33 +1595,39 @@
    Location 
-l
+anotherL
 ocation
-2
  = new Locat
@@ -1654,16 +1654,17 @@
 03120);%0A
+%0A
         
@@ -1683,36 +1683,41 @@
 als(location
-1
 , 
-l
+anotherL
 ocation
-2
 );%0A    %7D%0A%0A  
@@ -1805,25 +1805,28 @@
 ocation 
-l
+sameL
 ocation
-2
  = new L
@@ -1857,16 +1857,17 @@
 tude1);%0A
+%0A
         
@@ -1891,20 +1891,22 @@
 tion
-1
 , 
-l
+sameL
 ocation
-2
 );%0A 

Refactor LocationTest