EngineChecks { public static boolean checkIdentifier(String identifier) { if (identifier == null) { return false; } if (IDENTIFIER_PATTERN.matcher(identifier).matches()) { return true; } else { return false; } }  static boolean checkIdentifier(String identifier); static final String IDENTIFIED_FORM; }
@Test public void testValidIdentifiers() { assertTrue(EngineChecks.checkIdentifier("a")); assertTrue(EngineChecks.checkIdentifier("A")); assertTrue(EngineChecks.checkIdentifier("z")); assertTrue(EngineChecks.checkIdentifier("Z")); assertTrue(EngineChecks.checkIdentifier("abcdefghijklmnopqrstuvwxyz")); assertTrue(EngineChecks.checkIdentifier("ABCDEFGHIJKLMNOPQRSTUVWXYZ")); assertTrue(EngineChecks.checkIdentifier("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-")); }
@Test public void testInvalidIdentifiers() { assertFalse(EngineChecks.checkIdentifier("")); assertFalse(EngineChecks.checkIdentifier(null)); assertFalse(EngineChecks.checkIdentifier("-a")); assertFalse(EngineChecks.checkIdentifier("_a")); assertFalse(EngineChecks.checkIdentifier("0a")); }