aboutsummaryrefslogtreecommitdiff
path: root/test/org/traccar/location/CellInfoTest.java
blob: e78ce51fb514f34b887141bec39429d8a943028b (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
package org.traccar.location;

import org.junit.Assert;
import org.junit.Test;

public class CellInfoTest {

    @Test
    public void testToString() {

        CellInfo info = new CellInfo();
        info.addCell(0, 0, 1000, 2000);
        info.addCell(400, 1, 3000, 4000);

        Assert.assertEquals("[{\"lac\":1000,\"cid\":2000},{\"mcc\":400,\"mnc\":1,\"lac\":3000,\"cid\":4000}]", info.toString());

    }

    @Test
    public void testFromString() {

        CellInfo info = CellInfo.fromString("[{\"lac\":1000,\"cid\":2000}]");

        Assert.assertEquals(1, info.getCells().size());

        CellInfo.Cell cell = info.getCells().get(0);

        Assert.assertEquals(0, cell.getMcc());
        Assert.assertEquals(0, cell.getMnc());
        Assert.assertEquals(1000, cell.getLac());
        Assert.assertEquals(2000, cell.getCid());
        Assert.assertEquals(0, cell.getSignal());

    }

}