aboutsummaryrefslogtreecommitdiff
path: root/src/test/java/org/traccar/handler/MotionHandlerTest.java
blob: 93fd1620654bf0c5012437f41d1f375a889c0121 (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
package org.traccar.handler;

import org.junit.Test;
import org.traccar.model.Position;
import org.traccar.reports.common.TripsConfig;

import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

public class MotionHandlerTest {

    @Test
    public void testCalculateMotion() {

        TripsConfig tripsConfig = mock(TripsConfig.class);
        when(tripsConfig.getSpeedThreshold()).thenReturn(0.01);

        MotionHandler motionHandler = new MotionHandler(tripsConfig);

        Position position = motionHandler.handlePosition(new Position());

        assertEquals(false, position.getAttributes().get(Position.KEY_MOTION));

    }

}