Skip to content

Commit

Permalink
Remove public scope identifier frm junit classes and method
Browse files Browse the repository at this point in the history
Signed-off-by: Gino Augustine <[email protected]>
  • Loading branch information
ginoaugustine committed Oct 18, 2023
1 parent 9fc0a4b commit 5460430
Show file tree
Hide file tree
Showing 48 changed files with 254 additions and 266 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ public Locale getLocale() {
}

@Test
public void testNoHeaders() throws IOException, ServletException {
void testNoHeaders() throws IOException, ServletException {
CookieFilter filter = new CookieFilter();
HttpServletRequest request = mock(HttpServletRequest.class);
HttpServletResponse response = new DummyHttpServletResponse();
Expand All @@ -246,7 +246,7 @@ public void testNoHeaders() throws IOException, ServletException {
}

@Test
public void doTest() throws IOException, ServletException {
void doTest() throws IOException, ServletException {
CookieFilter filter = new CookieFilter();
HttpServletRequest request = mock(HttpServletRequest.class);
HttpServletResponse response = new DummyHttpServletResponse();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@
import static org.opengrok.web.api.v1.filter.CorsFilter.ALLOW_CORS_HEADER;
import static org.opengrok.web.api.v1.filter.CorsFilter.CORS_REQUEST_HEADER;

public class CorsFilterTest {
class CorsFilterTest {
@Test
public void nonCorsTest() {
void nonCorsTest() {
testBoth(null, null);
}

@Test
public void corsTest() {
void corsTest() {
testBoth("https://example.org", List.of("*"));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ public int compareTo(FileEntry fe) {
* Set up the test environment with repositories.
*/
@BeforeEach
public void setUp() throws Exception {
void setUp() throws Exception {
repositories = new TestRepository();
repositories.create(getClass().getResource("/repositories"));

Expand All @@ -233,7 +233,7 @@ public void setUp() throws Exception {
* Clean up after the test. Remove the test repositories.
*/
@AfterEach
public void tearDown() {
void tearDown() {
repositories.destroy();
repositories = null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@

import static org.junit.jupiter.api.Assertions.assertEquals;

public class PageConfigRequestedProjectsTest {
class PageConfigRequestedProjectsTest {

final RuntimeEnvironment env = RuntimeEnvironment.getInstance();

Expand All @@ -51,7 +51,7 @@ public class PageConfigRequestedProjectsTest {
private AuthorizationStack oldPluginStack;

@BeforeEach
public void setUp() {
void setUp() {
oldProjects = env.getProjects();
oldGroups = env.getGroups();
oldPluginStack = env.getPluginStack();
Expand Down Expand Up @@ -88,30 +88,30 @@ public void setUp() {
}

@AfterEach
public void tearDown() {
void tearDown() {
env.setProjects(oldProjects);
env.setGroups(oldGroups);
env.setPluginStack(oldPluginStack);
}

@Test
public void testSingleProject() {
void testSingleProject() {
final HttpServletRequest request = createRequest(new String[]{"project-1"}, null);

final PageConfig cfg = PageConfig.get(request);
assertEquals(new HashSet<>(Arrays.asList("project-1")), cfg.getRequestedProjects());
}

@Test
public void testMultipleProject() {
void testMultipleProject() {
final HttpServletRequest request = createRequest(new String[]{"project-1", "project-3", "project-6"}, null);

final PageConfig cfg = PageConfig.get(request);
assertEquals(new HashSet<>(Arrays.asList("project-1", "project-3", "project-6")), cfg.getRequestedProjects());
}

@Test
public void testNonIndexedProject() {
void testNonIndexedProject() {
env.getProjects().get("project-1").setIndexed(false);
final HttpServletRequest request = createRequest(new String[]{"project-1"}, null);

Expand All @@ -122,7 +122,7 @@ public void testNonIndexedProject() {
}

@Test
public void testMultipleWithNonIndexedProject() {
void testMultipleWithNonIndexedProject() {
env.getProjects().get("project-1").setIndexed(false);
final HttpServletRequest request = createRequest(new String[]{"project-1", "project-3", "project-6"}, null);

Expand All @@ -133,23 +133,23 @@ public void testMultipleWithNonIndexedProject() {
}

@Test
public void testSingleGroup1() {
void testSingleGroup1() {
final HttpServletRequest request = createRequest(null, new String[]{"group-1-2-3"});

final PageConfig cfg = PageConfig.get(request);
assertEquals(new HashSet<>(Arrays.asList("project-1", "project-2", "project-3")), cfg.getRequestedProjects());
}

@Test
public void testSingleGroup2() {
void testSingleGroup2() {
final HttpServletRequest request = createRequest(null, new String[]{"group-7-8-9"});

final PageConfig cfg = PageConfig.get(request);
assertEquals(new HashSet<>(Arrays.asList("project-7", "project-8", "project-9")), cfg.getRequestedProjects());
}

@Test
public void testMultipleGroup() {
void testMultipleGroup() {
final HttpServletRequest request = createRequest(null, new String[]{"group-1-2-3", "group-7-8-9"});

final PageConfig cfg = PageConfig.get(request);
Expand All @@ -159,7 +159,7 @@ public void testMultipleGroup() {
}

@Test
public void testMixedGroupAndProjectAddingNewProjects() {
void testMixedGroupAndProjectAddingNewProjects() {
final HttpServletRequest request = createRequest(new String[]{"project-1", "project-6"}, new String[]{"group-7-8-9"});

final PageConfig cfg = PageConfig.get(request);
Expand All @@ -170,7 +170,7 @@ public void testMixedGroupAndProjectAddingNewProjects() {


@Test
public void testMixedGroupNonExistentGroupAndProjectAddingNewProjects() {
void testMixedGroupNonExistentGroupAndProjectAddingNewProjects() {
final HttpServletRequest request = createRequest(new String[]{"project-1", "project-6"}, new String[]{"no-group", "group-7-8-9"});

final PageConfig cfg = PageConfig.get(request);
Expand All @@ -180,7 +180,7 @@ public void testMixedGroupNonExistentGroupAndProjectAddingNewProjects() {
}

@Test
public void testMixedGroupAndProjectInclusion() {
void testMixedGroupAndProjectInclusion() {
final HttpServletRequest request = createRequest(new String[]{"project-1", "project-2"}, new String[]{"group-1-2-3", "group-7-8-9"});

final PageConfig cfg = PageConfig.get(request);
Expand All @@ -190,7 +190,7 @@ public void testMixedGroupAndProjectInclusion() {
}

@Test
public void testNonIndexedInGroup() {
void testNonIndexedInGroup() {
env.getProjects().get("project-1").setIndexed(false);
final HttpServletRequest request = createRequest(null, new String[]{"group-1-2-3"});

Expand All @@ -204,7 +204,7 @@ public void testNonIndexedInGroup() {
* Assumes that there is no defaultProjects and no cookie set up.
*/
@Test
public void testNonExistentProject() {
void testNonExistentProject() {
final HttpServletRequest request = createRequest(new String[]{"no-project"}, null);

final PageConfig cfg = PageConfig.get(request);
Expand All @@ -215,15 +215,15 @@ public void testNonExistentProject() {
* Assumes that there is no defaultProjects and no cookie set up.
*/
@Test
public void testNonExistentGroup() {
void testNonExistentGroup() {
final HttpServletRequest request = createRequest(null, new String[]{"no-group"});

final PageConfig cfg = PageConfig.get(request);
assertEquals(new HashSet<>(), cfg.getRequestedProjects());
}

@Test
public void testSelectAllProjects() {
void testSelectAllProjects() {
final HttpServletRequest request = createRequest(null, null);
Mockito.when(request.getParameter(QueryParameters.ALL_PROJECT_SEARCH)).thenReturn("true");

Expand All @@ -232,7 +232,7 @@ public void testSelectAllProjects() {
}

@Test
public void testSelectAllProjectsOverrideProjectParam() {
void testSelectAllProjectsOverrideProjectParam() {
final HttpServletRequest request = createRequest(new String[]{"project-1", "project-2"}, null);
Mockito.when(request.getParameter(QueryParameters.ALL_PROJECT_SEARCH)).thenReturn("true");

Expand All @@ -241,7 +241,7 @@ public void testSelectAllProjectsOverrideProjectParam() {
}

@Test
public void testSelectAllProjectsOverrideGroupParam() {
void testSelectAllProjectsOverrideGroupParam() {
final HttpServletRequest request = createRequest(null, new String[]{"group-1-2-3"});
Mockito.when(request.getParameter(QueryParameters.ALL_PROJECT_SEARCH)).thenReturn("true");

Expand All @@ -250,7 +250,7 @@ public void testSelectAllProjectsOverrideGroupParam() {
}

@Test
public void testSelectAllOverrideNonExistentProject() {
void testSelectAllOverrideNonExistentProject() {
final HttpServletRequest request = createRequest(new String[]{"no-project"}, null);
Mockito.when(request.getParameter(QueryParameters.ALL_PROJECT_SEARCH)).thenReturn("true");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
/**
* Unit tests for the {@code PageConfig} class.
*/
public class PageConfigTest {
class PageConfigTest {
private static final String HASH_BB74B7E8 = "bb74b7e849170c31dc1b1b5801c83bf0094a3b10";
private static final String HASH_AA35C258 = "aa35c25882b9a60a97758e0ceb276a3f8cb4ae3a";
private static TestRepository repository = new TestRepository();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;

public class ProjectHelperExtendedTest extends ProjectHelperTestBase {
class ProjectHelperExtendedTest extends ProjectHelperTestBase {

@BeforeAll
public static void setUpClass() {
Expand Down Expand Up @@ -124,7 +124,7 @@ private Group getUnAllowedGroupWithoutSubgroups() {
}

@Test
public void testGetAllowedGroupSubgroups() {
void testGetAllowedGroupSubgroups() {
Set<Group> result = helper.getSubgroups(getAllowedGroupWithSubgroups());
assertEquals(1, result.size());
for (Group p : result) {
Expand All @@ -133,37 +133,37 @@ public void testGetAllowedGroupSubgroups() {
}

@Test
public void testGetUnAllowedGroupSubgroups() {
void testGetUnAllowedGroupSubgroups() {
Set<Group> result = helper.getSubgroups(getUnAllowedGroupWithSubgroups());
assertEquals(0, result.size());
}

@Test
public void testHasAllowedSubgroupAllowedSubgroups() {
void testHasAllowedSubgroupAllowedSubgroups() {
Group g = getAllowedGroupWithSubgroups();
assertTrue(helper.hasAllowedSubgroup(g));
}

@Test
public void testHasAllowedSubgroupUnAllowedSubgroups() {
void testHasAllowedSubgroupUnAllowedSubgroups() {
Group g = getUnAllowedGroupWithSubgroups();
assertFalse(helper.hasAllowedSubgroup(g));
}

@Test
public void testHasAllowedSubgroupAllowedNoSubgroups() {
void testHasAllowedSubgroupAllowedNoSubgroups() {
Group g = getAllowedGroupWithoutSubgroups();
assertFalse(helper.hasAllowedSubgroup(g));
}

@Test
public void testHasAllowedSubgroupUnAllowedNoSubgroups() {
void testHasAllowedSubgroupUnAllowedNoSubgroups() {
Group g = getUnAllowedGroupWithoutSubgroups();
assertFalse(helper.hasAllowedSubgroup(g));
}

@Test
public void testIsFavourite() {
void testIsFavourite() {
setupPageConfigRequest("grouped_project_0_1,"
+ "grouped_repository_2_2,"
+ "allowed_grouped_repository_0_2,"
Expand Down Expand Up @@ -192,7 +192,7 @@ public void testIsFavourite() {
}

@Test
public void testHasUngroupedFavouritePositive() {
void testHasUngroupedFavouritePositive() {
setupPageConfigRequest("grouped_project_0_1,"
+ "grouped_repository_2_2,"
+ "allowed_grouped_repository_0_2,"
Expand All @@ -204,7 +204,7 @@ public void testHasUngroupedFavouritePositive() {
}

@Test
public void testHasUngroupedFavouriteNegative() {
void testHasUngroupedFavouriteNegative() {
setupPageConfigRequest("grouped_project_0_1,"
+ "grouped_repository_2_2,"
+ "allowed_grouped_repository_0_2,"
Expand All @@ -215,7 +215,7 @@ public void testHasUngroupedFavouriteNegative() {
}

@Test
public void testHasFavourite() {
void testHasFavourite() {
String[] cookie = new String[] {
"grouped_project_2_1",
"allowed_grouped_project_2_1",
Expand Down
Loading

0 comments on commit 5460430

Please sign in to comment.