GetEnvironmentsUtilImpl implements GetEnvironmentsUtil { @NotNull @Override public String getCorrectCategoryName(@NotNull String defaultRunner) { int index = defaultRunner.indexOf('/') + 1; return defaultRunner.substring(index, defaultRunner.lastIndexOf('/')); } @Inject  GetEnvironmentsUtilImpl(ModelsFactory modelsFactory, ProjectTypeRegistry projectTypeRegistry, AppContext appContext); @NotNull @Override List<RunnerEnvironmentLeaf> getAllEnvironments(@NotNull RunnerEnvironmentTree tree); @NotNull @Override List<Environment> getEnvironmentsFromNodes(@NotNull List<RunnerEnvironmentLeaf> leaves, @NotNull Scope scope); @NotNull @Override List<Environment> getEnvironmentsByProjectType(@NotNull RunnerEnvironmentTree tree,
                                                          @NotNull String projectType,
                                                          @NotNull Scope scope); @Override @NotNull String getType(); @NotNull @Override String getCorrectCategoryName(@NotNull String defaultRunner); @NotNull @Override RunnerEnvironmentTree getRunnerCategoryByProjectType(@NotNull RunnerEnvironmentTree tree, @NotNull String projectType);  }
@Test public void correctCategoryNameShouldBeReturned() throws Exception { String category = util.getCorrectCategoryName("text/text/text"); assertThat(category, equalTo("text")); }