爱情易失不易得。——佚名
分享一个VIN
解析的代码
https://gitee.com/dromara/hutool/pulls/1005
使用方式
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
| 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;
import java.time.Year;
public class VinTest {
@Test public void parseVinTest() { String vinStr = "HE9XR1C48PS083871"; Vin vin = Vin.of(vinStr); Assertions.assertEquals("HE9XR1C48PS083871", vin.getCode()); Assertions.assertTrue(Vin.isValidVinCode(vinStr)); Assertions.assertTrue(vin.isLessThan1000()); Assertions.assertEquals("HE9", vin.wmiCode()); Assertions.assertEquals("HE", vin.geoCode()); Assertions.assertEquals("HE9083", vin.manufacturerCode()); Assertions.assertEquals("XR1C4", vin.vdsCode()); Assertions.assertEquals(Year.of(2023), vin.defaultYear()); Assertions.assertEquals("S", vin.oemCode()); Assertions.assertEquals("871", vin.prodNo()); }
}
|