Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
<dependency>
<groupId>io.jenkins.tools.bom</groupId>
<artifactId>bom-${jenkins.baseline}.x</artifactId>
<version>3944.v1a_e4f8b_452db_</version>
<version>4136.vca_c3202a_7fd1</version>
<scope>import</scope>
<type>pom</type>
</dependency>
Expand Down Expand Up @@ -108,7 +108,6 @@
<dependency>
<groupId>io.jenkins.plugins</groupId>
<artifactId>okhttp-api</artifactId>
<version>4.11.0-183.va_87fc7a_89810</version>
</dependency>
<dependency>
<groupId>io.jenkins.plugins</groupId>
Expand All @@ -124,7 +123,6 @@
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>antisamy-markup-formatter</artifactId>
<version>173.v680e3a_b_69ff3</version>
<optional>true</optional>
</dependency>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,35 @@
import io.jenkins.plugins.restlistparam.model.ValueItem;
import io.jenkins.plugins.restlistparam.model.ResultContainer;
import io.jenkins.plugins.restlistparam.model.ValueOrder;
import org.junit.Assert;
import org.junit.Test;
import org.junit.jupiter.api.Test;

import java.util.List;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;

// Task for later: more unit tests here (preferably replace integration tests)
public class RestValueServiceTest {
class RestValueServiceTest {

@Test
public void successfulGetIntegrationTest() {
void successfulGetIntegrationTest() {
ResultContainer<List<ValueItem>> test = RestValueService
.get("http://api.github.com/repos/jellyfin/jellyfin/tags?per_page=3",
.get("https://api.github.com/repos/jellyfin/jellyfin/tags?per_page=3",
null,
MimeType.APPLICATION_JSON,
0,
"$.*.name",
"$",
null,
ValueOrder.NONE);
Assert.assertFalse(test.getErrorMsg().isPresent());
Assert.assertEquals(3, test.getValue().size());
assertFalse(test.getErrorMsg().isPresent());
assertEquals(3, test.getValue().size());
}

@Test
public void unsuccessfulGetIntegrationTest() {
void unsuccessfulGetIntegrationTest() {
ResultContainer<List<ValueItem>> test = RestValueService
.get("https://gitlab.example.com/api/v4/projects/gitlab-org%2Fgitlab-runner/releases",
null,
Expand All @@ -38,8 +43,8 @@ public void unsuccessfulGetIntegrationTest() {
"$",
null,
ValueOrder.NONE);
Assert.assertNotNull(test);
Assert.assertTrue(test.getErrorMsg().isPresent());
Assert.assertEquals(0, test.getValue().size());
assertNotNull(test);
assertTrue(test.getErrorMsg().isPresent());
assertEquals(0, test.getValue().size());
}
}
Loading
Loading