@Test public void canCloseShouldReturnFalseWhenInvalid() throws Exception { final boolean actual = underTest.canClose("^invalid"); assertThat(actual) .overridingErrorMessage("Expected value returned by canClose is false, but was true") .isFalse(); }
@Override public boolean canClose(@Nullable String prefix) { if (Strings.isNullOrEmpty(prefix)) { return true; } if (!nameHelper.isIdentifier(prefix)) { return false; } final char first = prefix.charAt(0); return StringUtil.isJavaIdentifierStart(first); }
ClassPrefixValidator implements InputValidatorEx { @Override public boolean canClose(@Nullable String prefix) { if (Strings.isNullOrEmpty(prefix)) { return true; } if (!nameHelper.isIdentifier(prefix)) { return false; } final char first = prefix.charAt(0); return StringUtil.isJavaIdentifierStart(first); } }
ClassPrefixValidator implements InputValidatorEx { @Override public boolean canClose(@Nullable String prefix) { if (Strings.isNullOrEmpty(prefix)) { return true; } if (!nameHelper.isIdentifier(prefix)) { return false; } final char first = prefix.charAt(0); return StringUtil.isJavaIdentifierStart(first); } @Inject  ClassPrefixValidator(@NotNull Json2JavaBundle bundle, @NotNull PsiNameHelper nameHelper); }
ClassPrefixValidator implements InputValidatorEx { @Override public boolean canClose(@Nullable String prefix) { if (Strings.isNullOrEmpty(prefix)) { return true; } if (!nameHelper.isIdentifier(prefix)) { return false; } final char first = prefix.charAt(0); return StringUtil.isJavaIdentifierStart(first); } @Inject  ClassPrefixValidator(@NotNull Json2JavaBundle bundle, @NotNull PsiNameHelper nameHelper); @Nullable @Override String getErrorText(@Nullable String prefix); @Override boolean checkInput(@Nullable String prefix); @Override boolean canClose(@Nullable String prefix); }
ClassPrefixValidator implements InputValidatorEx { @Override public boolean canClose(@Nullable String prefix) { if (Strings.isNullOrEmpty(prefix)) { return true; } if (!nameHelper.isIdentifier(prefix)) { return false; } final char first = prefix.charAt(0); return StringUtil.isJavaIdentifierStart(first); } @Inject  ClassPrefixValidator(@NotNull Json2JavaBundle bundle, @NotNull PsiNameHelper nameHelper); @Nullable @Override String getErrorText(@Nullable String prefix); @Override boolean checkInput(@Nullable String prefix); @Override boolean canClose(@Nullable String prefix);  }