UcteNodeCode implements Comparable<UcteNodeCode> { public static boolean isUcteNodeId(String id) { return id != null && id.length() == 8 && isUcteCountryCode(id.charAt(0)) && isVoltageLevelCode(id.charAt(6)); } UcteNodeCode(UcteCountryCode ucteCountryCode, String geographicalSpot, UcteVoltageLevelCode voltageLevelCode, Character busbar); UcteCountryCode getUcteCountryCode(); void setUcteCountryCode(UcteCountryCode ucteCountryCode); String getGeographicalSpot(); void setGeographicalSpot(String geographicalSpot); UcteVoltageLevelCode getVoltageLevelCode(); void setVoltageLevelCode(UcteVoltageLevelCode voltageLevelCode); Character getBusbar(); void setBusbar(Character busbar); static Optional<UcteNodeCode> parseUcteNodeCode(String id); static boolean isUcteNodeId(String id); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString(); @Override int compareTo(UcteNodeCode ucteNodeCode);  }
@Test public void isUcteNodeIdTest() { assertTrue(isUcteNodeId("B_SU1_11")); assertTrue(isUcteNodeId("B_SU1_1 ")); assertTrue(isUcteNodeId("7efG8411")); assertFalse(isUcteNodeId(" ")); assertFalse(isUcteNodeId("B_SU1_")); assertFalse(isUcteNodeId("&ezrt874g")); }