diff --git a/BUILD.bazel b/BUILD.bazel
index c4fd875b54ba..95626ca52944 100644
--- a/BUILD.bazel
+++ b/BUILD.bazel
@@ -268,6 +268,7 @@ jvm_library(
"//jvm/jvm-analysis-impl:analysis-impl",
"//plugins/ByteCodeViewer:java-byteCodeViewer",
"//plugins/github/github-json:vcs-github-json",
+ "//plugins/github/github-tracker:vcs-github-tracker",
"//plugins/search-everywhere-ml/ranking/core",
"//plugins/search-everywhere-ml/ranking/java",
"//plugins/search-everywhere-ml/ranking/vcs",
@@ -548,6 +549,7 @@ jvm_library(
"//jvm/jvm-analysis-impl:analysis-impl",
"//plugins/ByteCodeViewer:java-byteCodeViewer",
"//plugins/github/github-json:vcs-github-json",
+ "//plugins/github/github-tracker:vcs-github-tracker",
"//plugins/search-everywhere-ml/ranking/core",
"//plugins/search-everywhere-ml/ranking/java",
"//plugins/search-everywhere-ml/ranking/vcs",
diff --git a/intellij.idea.community.main.iml b/intellij.idea.community.main.iml
index c12c5b31e095..83049b499c71 100644
--- a/intellij.idea.community.main.iml
+++ b/intellij.idea.community.main.iml
@@ -232,6 +232,7 @@
+
diff --git a/plugins/github/github-tracker/src/org/jetbrains/plugins/github/tasks/GithubRepository.java b/plugins/github/github-tracker/src/org/jetbrains/plugins/github/tasks/GithubRepository.java
index ec2813290e53..006359da0c1e 100644
--- a/plugins/github/github-tracker/src/org/jetbrains/plugins/github/tasks/GithubRepository.java
+++ b/plugins/github/github-tracker/src/org/jetbrains/plugins/github/tasks/GithubRepository.java
@@ -15,16 +15,14 @@ import com.intellij.tasks.*;
import com.intellij.tasks.impl.BaseRepository;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.xmlb.annotations.Tag;
+import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
+import org.jetbrains.annotations.VisibleForTesting;
import org.jetbrains.plugins.github.api.GithubApiRequestExecutor;
import org.jetbrains.plugins.github.api.GithubApiRequests;
import org.jetbrains.plugins.github.api.GithubServerPath;
-import org.jetbrains.plugins.github.api.data.GithubIssue;
-import org.jetbrains.plugins.github.api.data.GithubIssueBase;
-import org.jetbrains.plugins.github.api.data.GithubIssueCommentWithHtml;
-import org.jetbrains.plugins.github.api.data.GithubIssueLabel;
-import org.jetbrains.plugins.github.api.data.GithubIssueState;
+import org.jetbrains.plugins.github.api.data.*;
import org.jetbrains.plugins.github.api.util.GithubApiPagesLoader;
import org.jetbrains.plugins.github.exceptions.GithubAuthenticationException;
import org.jetbrains.plugins.github.exceptions.GithubJsonException;
@@ -41,16 +39,17 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern;
@Tag("GitHub")
-final class GithubRepository extends BaseRepository {
-
+@VisibleForTesting
+@ApiStatus.Internal
+public final class GithubRepository extends BaseRepository {
private Pattern myPattern = Pattern.compile("($^)");
private @NotNull String myRepoAuthor = "";
private @NotNull String myRepoName = "";
private @NotNull String myUser = "";
private boolean myAssignedIssuesOnly = false;
- @SuppressWarnings("UnusedDeclaration")
- GithubRepository() {
+ @VisibleForTesting
+ public GithubRepository() {
}
GithubRepository(GithubRepository other) {
@@ -157,7 +156,8 @@ final class GithubRepository extends BaseRepository {
return tasks.toArray(Task.EMPTY_ARRAY);
}
- private @NotNull Task createTask(@NotNull GithubIssueBase issue, @NotNull List comments) {
+ @VisibleForTesting
+ public @NotNull Task createTask(@NotNull GithubIssueBase issue, @NotNull List comments) {
return new Task() {
private final @NotNull String myRepoName = getRepoName();
private final Comment @NotNull [] myComments =
diff --git a/plugins/github/github-tracker/test/org/jetbrains/plugins/github/tasks/GithubRepositoryTest.java b/plugins/github/github-tracker/test/org/jetbrains/plugins/github/tasks/GithubRepositoryTest.java
index 11cd63bbd205..a8cf6fecbe05 100644
--- a/plugins/github/github-tracker/test/org/jetbrains/plugins/github/tasks/GithubRepositoryTest.java
+++ b/plugins/github/github-tracker/test/org/jetbrains/plugins/github/tasks/GithubRepositoryTest.java
@@ -11,15 +11,12 @@ import org.jetbrains.plugins.github.api.data.GithubIssueLabel;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
import java.util.Collections;
import java.util.List;
import static org.junit.jupiter.api.Assertions.assertEquals;
-public class GithubRepositoryTest {
-
+class GithubRepositoryTest {
private GithubRepository repository;
@BeforeEach
@@ -28,21 +25,21 @@ public class GithubRepositoryTest {
}
@Test
- public void testCreateTaskBug() throws InvocationTargetException, NoSuchMethodException, IllegalAccessException {
+ public void testCreateTaskBug() {
GithubIssueBase issue = makeIssueWithLabels(Collections.singletonList("bug"));
Task task = createTask(repository, issue, Collections.emptyList());
assertEquals(TaskType.BUG, task.getType());
}
@Test
- public void testCreateTaskFeature() throws InvocationTargetException, NoSuchMethodException, IllegalAccessException {
+ public void testCreateTaskFeature() {
GithubIssueBase issue = makeIssueWithLabels(Collections.singletonList("enhancement"));
Task task = createTask(repository, issue, Collections.emptyList());
assertEquals(TaskType.FEATURE, task.getType());
}
@Test
- public void testCreateTaskUnmapped() throws InvocationTargetException, NoSuchMethodException, IllegalAccessException {
+ public void testCreateTaskUnmapped() {
// Test with a label that is not recognized as a specific type
GithubIssueBase issue = makeIssueWithLabels(Collections.singletonList("question"));
Task task = createTask(repository, issue, Collections.emptyList());
@@ -50,7 +47,7 @@ public class GithubRepositoryTest {
}
@Test
- public void testCreateTaskMultipleLabelsMatchFirstWins() throws InvocationTargetException, NoSuchMethodException, IllegalAccessException {
+ public void testCreateTaskMultipleLabelsMatchFirstWins() {
GithubIssueBase issue = makeIssueWithLabels(
List.of("bug", "enhancement", "feature", "task", "question") // Multiple labels including bug and enhancement
);
@@ -59,7 +56,7 @@ public class GithubRepositoryTest {
}
@Test
- public void testCreateTaskMultipleLabelsSingleMatch() throws InvocationTargetException, NoSuchMethodException, IllegalAccessException {
+ public void testCreateTaskMultipleLabelsSingleMatch() {
GithubIssueBase issue = makeIssueWithLabels(
List.of("custom1", "enhancement", "custom2") // Multiple labels including enhancement in the middle
);
@@ -68,7 +65,7 @@ public class GithubRepositoryTest {
}
@Test
- public void testCreateTaskNoLabel() throws InvocationTargetException, NoSuchMethodException, IllegalAccessException {
+ public void testCreateTaskNoLabel() {
GithubIssueBase issue = makeIssueWithLabels(
Collections.emptyList()
);
@@ -114,15 +111,9 @@ public class GithubRepositoryTest {
* @param issue the GithubIssueBase instance
* @param comments the list of comments associated with the issue
* @return a Task object created by the private createTask method
- * @throws NoSuchMethodException if the method is not found
- * @throws InvocationTargetException if the method invocation fails
- * @throws IllegalAccessException if access to the method is denied
*/
- private static Task createTask(GithubRepository repo, GithubIssueBase issue, List comments)
- throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
- Method createTask = GithubRepository.class.getDeclaredMethod("createTask", GithubIssueBase.class, List.class);
- createTask.setAccessible(true);
- Task task = (Task) createTask.invoke(repo, issue, comments);
+ private static Task createTask(GithubRepository repo, GithubIssueBase issue, List comments) {
+ Task task = repo.createTask(issue, comments);
return task;
}