@@ -0,0 +1,2458 @@
+/*%0A *  Copyright (C) 2016  Datamatica (dev@datamatica.pl)%0A * %0A *  This program is free software: you can redistribute it and/or modify%0A *  it under the terms of the GNU Affero General Public License as published%0A *  by the Free Software Foundation, either version 3 of the License, or%0A *  (at your option) any later version.%0A * %0A *  This program is distributed in the hope that it will be useful,%0A *  but WITHOUT ANY WARRANTY; without even the implied warranty of%0A *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the%0A *  GNU Affero General Public License for more details.%0A * %0A *  You should have received a copy of the GNU Affero General Public License%0A *  along with this program. If not, see %3Chttp://www.gnu.org/licenses/%3E.%0A */%0Apackage pl.datamatica.traccar.api.dtos;%0A%0Aimport java.util.Arrays;%0Aimport java.util.HashSet;%0Aimport static org.junit.Assert.assertEquals;%0Aimport org.junit.Test;%0Aimport pl.datamatica.traccar.api.dtos.out.DeviceDto;%0Aimport pl.datamatica.traccar.model.Device;%0Aimport pl.datamatica.traccar.model.User;%0A%0A/**%0A *%0A * @author Jan Usarek%0A */%0Apublic class DeviceDtoSpeedUnitConversionTest %7B%0A%0A    @Test%0A    public void testSpeedLimitUnitConversion() throws Exception %7B%0A        Device testDevice = getTestDevice();%0A        double speedNauticalMiles = 1000D;%0A        int expectedSpeedKmH = 1852;%0A%0A        testDevice.setSpeedLimit(speedNauticalMiles);%0A%0A        HashSet%3CLong%3E availableUserIds = new HashSet%3C%3E(Arrays.asList(1L));%0A        DeviceDto deviceDto = new DeviceDto.Builder().device(testDevice, availableUserIds).build();%0A%0A        assertEquals(expectedSpeedKmH, deviceDto.getSpeedLimit().intValue());%0A    %7D%0A%0A    @Test%0A    public void testIdleSpeedThresholdUnitConversion() throws Exception %7B%0A        Device testDevice = getTestDevice();%0A        double speedNauticalMiles = 1000D;%0A        int expectedSpeedKmH = 1852;%0A%0A        testDevice.setIdleSpeedThreshold(speedNauticalMiles);%0A%0A        HashSet%3CLong%3E availableUserIds = new HashSet%3C%3E(Arrays.asList(1L));%0A        DeviceDto deviceDto = new DeviceDto.Builder().device(testDevice, availableUserIds).build();%0A%0A        assertEquals(expectedSpeedKmH, deviceDto.getIdleSpeedThreshold().intValue());%0A    %7D%0A%0A    private Device getTestDevice() %7B%0A        User owner = new User();%0A        Device device = new Device();%0A%0A        device.setName(%22Test Device%22);%0A        device.setOwner(owner);%0A        device.setUsers(new HashSet%3C%3E(Arrays.asList(owner)));%0A%0A        return device;%0A    %7D%0A%7D%0A

Add unit tests for speed conversion in DeviceDto