@Test public void isValidString() { String validString = IDENTIFIER + DELIMITER + CLASS_NAME; assertTrue(DefaultImport.isValidString(validString)); String invalidString1 = IDENTIFIER; assertFalse(DefaultImport.isValidString(invalidString1)); String invalidString2 = IDENTIFIER + DELIMITER + CLASS_NAME + DELIMITER + "invalid"; assertFalse(DefaultImport.isValidString(invalidString2)); String invalidString3 = "invalid" + DELIMITER + CLASS_NAME; assertFalse(DefaultImport.isValidString(invalidString3)); String invalidString4 = IDENTIFIER + DELIMITER + STRING_EMPTY; assertFalse(DefaultImport.isValidString(invalidString4)); }
public static Boolean isValidString(String importValue) { String[] importParts = splitImportString(importValue); if (importParts.length != 2) { return false; } if (!importParts[0].equals(IDENTIFIER)) { return false; } if (importParts[1].isEmpty()) { return false; } return true; }
DefaultImport { public static Boolean isValidString(String importValue) { String[] importParts = splitImportString(importValue); if (importParts.length != 2) { return false; } if (!importParts[0].equals(IDENTIFIER)) { return false; } if (importParts[1].isEmpty()) { return false; } return true; } }
DefaultImport { public static Boolean isValidString(String importValue) { String[] importParts = splitImportString(importValue); if (importParts.length != 2) { return false; } if (!importParts[0].equals(IDENTIFIER)) { return false; } if (importParts[1].isEmpty()) { return false; } return true; } DefaultImport();  DefaultImport(@MapsTo("className") final String className); }
DefaultImport { public static Boolean isValidString(String importValue) { String[] importParts = splitImportString(importValue); if (importParts.length != 2) { return false; } if (!importParts[0].equals(IDENTIFIER)) { return false; } if (importParts[1].isEmpty()) { return false; } return true; } DefaultImport();  DefaultImport(@MapsTo("className") final String className); static Boolean isValidString(String importValue); static DefaultImport fromString(String importValue); String getClassName(); void setClassName(final String className); @Override String toString(); }
DefaultImport { public static Boolean isValidString(String importValue) { String[] importParts = splitImportString(importValue); if (importParts.length != 2) { return false; } if (!importParts[0].equals(IDENTIFIER)) { return false; } if (importParts[1].isEmpty()) { return false; } return true; } DefaultImport();  DefaultImport(@MapsTo("className") final String className); static Boolean isValidString(String importValue); static DefaultImport fromString(String importValue); String getClassName(); void setClassName(final String className); @Override String toString(); static final String DELIMITER; static final String IDENTIFIER; }