WizardUtils { public static String getUniqueName(String initialValue, Validator<String> validator) { int i = 2; String uniqueName = initialValue; while (i <= 100 && validator.validate(uniqueName).getSeverity() == Validator.Severity.ERROR) { uniqueName = initialValue + Integer.toString(i); i++; } return uniqueName; }  @NotNull static File getProjectLocationParent(); @Nullable static String validatePackageName(@Nullable String packageName); @NotNull static String toHtmlString(@NotNull String text); @NotNull static URL toUrl(@NotNull String urlAsString); static String getUniqueName(String initialValue, Validator<String> validator); static boolean hasComposeMinAgpVersion(@Nullable Project project, @Nullable String templateCategory); static final String COMPOSE_MIN_AGP_VERSION; }
@Test public void getUniqueNameForAlwaysOKResult() { assertThat(getUniqueName("test", value -> OK)).isEqualTo("test"); }
@Test public void getUniqueNameForAlwaysERRORResult() { assertThat(getUniqueName("test", value -> ERROR)).isEqualTo("test100"); }
@Test public void getUniqueNameForAlwaysWarningResult() { assertThat(getUniqueName("test", value -> WARNING)).isEqualTo("test"); }
@Test public void getUniqueNameForAlwaysInfoResult() { assertThat(getUniqueName("test", value -> INFO)).isEqualTo("test"); }
@Test public void getUniqueNameForSomeOKResult() { assertThat(getUniqueName("test", value -> value.endsWith("9") ? OK : ERROR)).isEqualTo("test9"); }