This commit is contained in:
Looly
2023-06-09 00:50:16 +08:00
parent ca2594a08c
commit 905ddbd8dd
11 changed files with 311 additions and 814 deletions

View File

@@ -1,6 +1,5 @@
package org.dromara.hutool.core.data;
import org.dromara.hutool.core.data.vin.Vin;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
@@ -8,34 +7,29 @@ import java.time.Year;
/**
* @author VampireAchao
* @since 2023/5/31 14:43
*/
public class VinTest {
@Test
public void parseVinTest() {
String vinStr = "HE9XR1C48PS083871";
Vin vin = Vin.of(vinStr);
final String vinStr = "HE9XR1C48PS083871";
final VIN vin = VIN.of(vinStr);
// VIN
Assertions.assertEquals("HE9XR1C48PS083871", vin.getCode());
// 是否合法
Assertions.assertTrue(Vin.isValidVinCode(vinStr));
// 年产量<1000
Assertions.assertTrue(vin.isLessThan1000());
// WMI
Assertions.assertEquals("HE9", vin.wmiCode());
// 地理区域码
Assertions.assertEquals("HE", vin.geoCode());
// 主机厂代码
Assertions.assertEquals("HE9083", vin.manufacturerCode());
Assertions.assertEquals("HE", vin.getCountryCode());
// WMI主机厂代码
Assertions.assertEquals("HE9083", vin.getWMI());
// VDS
Assertions.assertEquals("XR1C4", vin.vdsCode());
Assertions.assertEquals("XR1C48", vin.getVDS());
// 车型年份
Assertions.assertEquals(Year.of(2023), vin.defaultYear());
Assertions.assertEquals(Year.of(2023), vin.getYear());
// OEM厂商
Assertions.assertEquals("S", vin.oemCode());
Assertions.assertEquals('S', vin.getOemCode());
// 生产序号
Assertions.assertEquals("871", vin.prodNo());
Assertions.assertEquals("871", vin.getProdNo());
}
}