summaryrefslogtreecommitdiff
path: root/android/java/MapboxGLAndroidSDKTestApp/src/test/java/CoordinateSpanTest.java
blob: ef10c5bed1571e752f5af349f40def42cf46b0cd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import com.mapbox.mapboxsdk.geometry.CoordinateSpan;

import org.junit.Test;

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

public class CoordinateSpanTest {

    private static final double DELTA = 1e-15;

    @Test
    public void testSanity() {
        CoordinateSpan coordinateSpan = new CoordinateSpan(0.0, 0.0);
        assertNotNull("coordinateSpan should not be null", coordinateSpan);
    }

    @Test
    public void testLatitudeConstructor() {
        double latitude = 1.23;
        CoordinateSpan coordinateSpan = new CoordinateSpan(latitude, 0.0);
        assertEquals("latitude in constructor", coordinateSpan.getLatitudeSpan(), latitude, DELTA);
    }

    @Test
    public void testLongitudeConstructor() {
        double longitude = 1.23;
        CoordinateSpan coordinateSpan = new CoordinateSpan(0.0, longitude);
        assertEquals("latitude in constructor", coordinateSpan.getLongitudeSpan(), longitude, DELTA);
    }

    @Test
    public void testLatitudeMethod() {
        double latitude = 1.23;
        CoordinateSpan coordinateSpan = new CoordinateSpan(0.0, 0.0);
        coordinateSpan.setLatitudeSpan(latitude);
        assertEquals("latitude in constructor", coordinateSpan.getLatitudeSpan(), latitude, DELTA);
    }

    @Test
    public void testLongitudeMethod() {
        double longitude = 1.23;
        CoordinateSpan coordinateSpan = new CoordinateSpan(0.0, 0.0);
        coordinateSpan.setLongitudeSpan(longitude);
        assertEquals("latitude in constructor", coordinateSpan.getLongitudeSpan(), longitude, DELTA);
    }

}