summaryrefslogtreecommitdiff
path: root/platform/android/MapboxGLAndroidSDKTestApp/src/test/java/com/mapbox/mapboxsdk/maps/MarkerTest.java
blob: efe94e53962e1438fd2a5842e57a17960a0b020f (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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
package com.mapbox.mapboxsdk.maps;

import com.mapbox.mapboxsdk.annotations.Marker;
import com.mapbox.mapboxsdk.annotations.MarkerOptions;
import com.mapbox.mapboxsdk.geometry.LatLng;

import org.junit.Test;

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

public class MarkerTest {

    @Test
    public void testSanity() {
        MarkerOptions markerOptions = new MarkerOptions();
        assertNotNull("markerOptions should not be null", markerOptions);
    }

    @Test
    public void testMarker() {
        MarkerOptions markerOptions = new MarkerOptions();
        assertNotNull("marker should not be null", markerOptions.getMarker());
    }

    @Test
    public void testPosition() {
        Marker marker = new MarkerOptions().position(new LatLng(10, 12)).getMarker();
        assertEquals(marker.getPosition(), new LatLng(10, 12));
    }

    @Test
    public void testTitle() {
        Marker marker = new MarkerOptions().title("Mapbox").getMarker();
        assertEquals(marker.getTitle(), "Mapbox");
    }

    @Test
    public void testSnippet() {
        Marker marker = new MarkerOptions().snippet("Mapbox").getMarker();
        assertEquals(marker.getSnippet(), "Mapbox");
    }

    @Test
    public void testBuilder() {
        Marker marker = new MarkerOptions().title("title").snippet("snippet").position(new LatLng(10, 12)).getMarker();
        assertEquals(marker.getTitle(), "title");
        assertEquals(marker.getSnippet(), "snippet");
        assertEquals(marker.getPosition(), new LatLng(10, 12));
    }

    @Test
    public void testIcon() {
        // find a way to test Icon
    }

    @Test
    public void testHashCode() {
        Marker marker = new MarkerOptions().position(new LatLng(10, 12)).getMarker();
        assertEquals("hash code should match", marker.hashCode(), -1946419200);
    }

    @Test
    public void testEquality() {
        Marker markerOne = new MarkerOptions().position(new LatLng(0, 0)).getMarker();
        Marker markerTwo = new MarkerOptions().position(new LatLng(0, 0)).getMarker();
        assertEquals(markerOne, markerTwo);
    }

    @Test
    public void testToString() {
        Marker marker = new MarkerOptions().position(new LatLng(0, 0)).getMarker();
        assertEquals(marker.toString(), "Marker [position[" + "LatLng [longitude=0.0, latitude=0.0, altitude=0.0]" + "]]");
    }

}