@Test public void convertShouldReturnTextWithPrefix() throws Exception { final ClassNamePolicy underTest = new ClassNamePolicy(nameHelper, "Baz", ""); final String actual = underTest.convert("foo_bar", TypeName.OBJECT); assertThat(actual) .isEqualTo("BazFooBar"); }
@Nonnull @Override public String convert(@Nonnull String name, @Nonnull TypeName type) { final StringBuilder builder = new StringBuilder(); builder.append(prefix) .append(DefaultNamePolicy.CLASS.convert(name, type)) .append(suffix); final String className = builder.toString(); if (!nameHelper.isQualifiedName(className)) { throw new IllegalArgumentException("Cannot convert '" + name + "' to class name"); } return className; }
ClassNamePolicy implements NamePolicy { @Nonnull @Override public String convert(@Nonnull String name, @Nonnull TypeName type) { final StringBuilder builder = new StringBuilder(); builder.append(prefix) .append(DefaultNamePolicy.CLASS.convert(name, type)) .append(suffix); final String className = builder.toString(); if (!nameHelper.isQualifiedName(className)) { throw new IllegalArgumentException("Cannot convert '" + name + "' to class name"); } return className; } }
ClassNamePolicy implements NamePolicy { @Nonnull @Override public String convert(@Nonnull String name, @Nonnull TypeName type) { final StringBuilder builder = new StringBuilder(); builder.append(prefix) .append(DefaultNamePolicy.CLASS.convert(name, type)) .append(suffix); final String className = builder.toString(); if (!nameHelper.isQualifiedName(className)) { throw new IllegalArgumentException("Cannot convert '" + name + "' to class name"); } return className; } @Inject  ClassNamePolicy(@Nonnull PsiNameHelper nameHelper, @Nonnull String prefix, @Nonnull String suffix); }
ClassNamePolicy implements NamePolicy { @Nonnull @Override public String convert(@Nonnull String name, @Nonnull TypeName type) { final StringBuilder builder = new StringBuilder(); builder.append(prefix) .append(DefaultNamePolicy.CLASS.convert(name, type)) .append(suffix); final String className = builder.toString(); if (!nameHelper.isQualifiedName(className)) { throw new IllegalArgumentException("Cannot convert '" + name + "' to class name"); } return className; } @Inject  ClassNamePolicy(@Nonnull PsiNameHelper nameHelper, @Nonnull String prefix, @Nonnull String suffix); @Nonnull @Override String convert(@Nonnull String name, @Nonnull TypeName type); }
ClassNamePolicy implements NamePolicy { @Nonnull @Override public String convert(@Nonnull String name, @Nonnull TypeName type) { final StringBuilder builder = new StringBuilder(); builder.append(prefix) .append(DefaultNamePolicy.CLASS.convert(name, type)) .append(suffix); final String className = builder.toString(); if (!nameHelper.isQualifiedName(className)) { throw new IllegalArgumentException("Cannot convert '" + name + "' to class name"); } return className; } @Inject  ClassNamePolicy(@Nonnull PsiNameHelper nameHelper, @Nonnull String prefix, @Nonnull String suffix); @Nonnull @Override String convert(@Nonnull String name, @Nonnull TypeName type);  }