Commit 56afbdf1 authored by Greg Messner's avatar Greg Messner
Browse files

Consolidated tests.

parent dc982127
package com.messners.gitlab.api;
import static org.junit.Assert.assertTrue;
import org.junit.BeforeClass;
import org.junit.Test;
public class TestCreateProjectAndMergeRequest {
// The following needs to be set to your test repository
private static final String TEST_HOST_URL = "https://your.gitlab.host.url";
private static final String TEST_PRIVATE_TOKEN = "YOUR PRIVATE TOKEN";
private static GitLabApi gitLabApi;
public TestCreateProjectAndMergeRequest () {
super();
}
@BeforeClass
public static void setup () {
gitLabApi = new GitLabApi(TEST_HOST_URL, TEST_PRIVATE_TOKEN);
}
@Test
public void testCreateProject () {
try {
Project newProject = new Project();
newProject.setName("test-gitlab-api-project");
Project project = gitLabApi.createProject(newProject);
assertTrue(project != null);
assertTrue(project.getName().equals(newProject.getName()));
gitLabApi.deleteProject(project);
} catch (Exception e) {
System.err.println("Check TEST_HOST_URL and TEST_PRIVATE_TOKEN, they are probably not set.");
}
}
}
...@@ -46,24 +46,4 @@ public class TestGitLabApi { ...@@ -46,24 +46,4 @@ public class TestGitLabApi {
System.err.println("Check TEST_HOST_URL and TEST_PRIVATE_TOKEN, they are probably not set."); System.err.println("Check TEST_HOST_URL and TEST_PRIVATE_TOKEN, they are probably not set.");
} }
} }
@Test
public void testOwnedProjectsProject () {
try {
List<Project> projects = gitLabApi.getOwnedProjects();
assertTrue(projects != null);
Project ownedProject = projects.get(0);
assertTrue(ownedProject != null);
Project project = gitLabApi.getProject(ownedProject.getId());
assertTrue(project != null);
assertTrue(ownedProject.getId().equals(project.getId()));
} catch (Exception e) {
System.err.println("Check TEST_HOST_URL and TEST_PRIVATE_TOKEN, they are probably not set.");
}
}
} }
...@@ -15,7 +15,7 @@ import org.junit.Test; ...@@ -15,7 +15,7 @@ import org.junit.Test;
public class TestGitLabApiBeans { public class TestGitLabApiBeans {
private static JacksonJsonConfig jacksonJsonConfig; private static JacksonJson jacksonJsonConfig;
public TestGitLabApiBeans () { public TestGitLabApiBeans () {
super(); super();
...@@ -23,7 +23,7 @@ public class TestGitLabApiBeans { ...@@ -23,7 +23,7 @@ public class TestGitLabApiBeans {
@BeforeClass @BeforeClass
public static void setup () { public static void setup () {
jacksonJsonConfig = new JacksonJsonConfig(); jacksonJsonConfig = new JacksonJson();
} }
@Test @Test
......
...@@ -16,7 +16,7 @@ import com.messners.gitlab.api.webhook.PushEvent; ...@@ -16,7 +16,7 @@ import com.messners.gitlab.api.webhook.PushEvent;
public class TestGitLabApiEvents { public class TestGitLabApiEvents {
private static JacksonJsonConfig jacksonJsonConfig; private static JacksonJson jacksonJsonConfig;
public TestGitLabApiEvents () { public TestGitLabApiEvents () {
super(); super();
...@@ -24,7 +24,7 @@ public class TestGitLabApiEvents { ...@@ -24,7 +24,7 @@ public class TestGitLabApiEvents {
@BeforeClass @BeforeClass
public static void setup () { public static void setup () {
jacksonJsonConfig = new JacksonJsonConfig(); jacksonJsonConfig = new JacksonJson();
} }
@Test @Test
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment