CreateNewClassDialogValidatorExImpl implements CreateNewClassDialogValidatorEx { @Override public boolean checkPackage(@NotNull String inputString) { return CharMatcher.whitespace().matchesAllOf(inputString) || checkList(inputString, "."); } CreateNewClassDialogValidatorExImpl(Project project); static boolean isValidJavaIdentifier(String identifier); @Override boolean checkSuperclass(@NotNull String inputString); @Override boolean checkInterface(@NotNull String inputString); @Override boolean checkPackage(@NotNull String inputString); @Nullable @Override String getErrorText(String inputString); @NotNull @Override String getNameErrorText(@Nullable String inputString); @NotNull @Override String getSuperclassErrorText(@Nullable String inputString); @NotNull @Override String getInterfacesErrorText(@Nullable String inputString); @NotNull @Override String getNotAClassErrorText(@Nullable String inputString); @NotNull @Override String getNotAnInterfaceErrorText(@Nullable String inputString); @NotNull @Override String getPackageErrorText(@Nullable String inputString); @Override boolean checkInput(String inputString); @Override boolean canClose(String inputString); static final String INVALID_PACKAGE_MESSAGE; static final String INVALID_QUALIFIED_NAME_FOR_NEW_NAME; static final String INVALID_QUALIFIED_NAME_FOR_INTERFACE; static final String INVALID_QUALIFIED_NAME_FOR_SUPERCLASS; static final String INVALID_QUALIFIED_NAME; static final String NOT_A_VALID_INTERFACE; static final String NOT_A_VALID_CLASS; }
@Test public void checkPackageGood() { assertTrue(validator.checkPackage("_abc123.xyz.ABC.ABC")); }
@Test public void checkPackageGoodSpaces() { assertTrue(validator.checkPackage("_abc123 .xyz . ABC. ABC")); }
@Test public void checkPackageEmpty() { assertTrue(validator.checkPackage("")); }
@Test public void checkPackageLeadingNumber() { assertFalse(validator.checkPackage("8_abc123.xyz.ABC.ABC")); }
@Test public void checkPackageLeadingDot() { assertFalse(validator.checkPackage("._abc123.xyz.ABC.ABC")); }
@Test public void checkPackageTrailingDot() { assertFalse(validator.checkPackage("_abc123.xyz.ABC.ABC.")); }
@Test public void checkPackageDash() { assertFalse(validator.checkPackage("_abc123-xyz.ABC.ABC")); }
@Test public void checkPackageComma() { assertFalse(validator.checkPackage("_abc123,xyz.ABC.ABC")); }
@Test public void checkPackageBadSpace() { assertFalse(validator.checkPackage("_abc123 xyz.ABC.ABC")); }