### Question:
DeviceIdStruct { void setProductClass(String productClass) { this.productClass = DeviceIdStructHelper.parseProductClass(productClass); } DeviceIdStruct();  static final String ID; }### Answer:
@Test public void parseUnittypeNameWithForwardSlash() { String unittypeNameStr = "ODU/xxx/yyya²"; DeviceIdStruct struct = new DeviceIdStruct(); struct.setProductClass(unittypeNameStr); Assert.assertEquals("ODU-xxx-yyya2", struct.getProductClass()); }
@Test public void parseUnittypeNameWithBackwardSlash() { String unittypeNameStr = "ODU\\xxx\\yyya²"; DeviceIdStruct struct = new DeviceIdStruct(); struct.setProductClass(unittypeNameStr); Assert.assertEquals("ODU-xxx-yyya2", struct.getProductClass()); }
@Test public void mustSupportNull() { String unittypeNameStr = null; DeviceIdStruct struct = new DeviceIdStruct(); struct.setProductClass(unittypeNameStr); Assert.assertNull(struct.getProductClass()); }