Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
bitwiseman committed Oct 4, 2019
1 parent fc08711 commit d787359
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 50 deletions.
54 changes: 31 additions & 23 deletions src/test/java/org/kohsuke/github/GHProjectCardTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;

import java.io.FileNotFoundException;
Expand All @@ -16,9 +17,9 @@ public class GHProjectCardTest extends AbstractGitHubApiTestBase {
private GHProjectColumn column;
private GHProjectCard card;

@Override public void setUp() throws Exception {
super.setUp();
org = gitHub.getOrganization("github-api-test-org");
@Before
public void setUp() throws Exception {
org = gitHub.getOrganization(GITHUB_API_TEST_ORG);
project = org.createProject("test-project", "This is a test project");
column = project.createColumn("column-one");
card = column.createCard("This is a card");
Expand Down Expand Up @@ -71,28 +72,35 @@ public void testDeleteCard() throws IOException {

@After
public void after() throws IOException {
if(card != null) {
try {
card.delete();
card = null;
} catch (FileNotFoundException e) {
card = null;
if(githubApi.isUseProxy()) {
if (card != null) {
card = gitHubBeforeAfter.getProjectCard(card.getId());
try {
card.delete();
card = null;
} catch (FileNotFoundException e) {
card = null;
}
}
}
if(column != null) {
try {
column.delete();
column = null;
} catch (FileNotFoundException e) {
column = null;
if (column != null) {
column = gitHubBeforeAfter
.getProjectColumn(column.getId());
try {
column.delete();
column = null;
} catch (FileNotFoundException e) {
column = null;
}
}
}
if(project != null) {
try {
project.delete();
project = null;
} catch (FileNotFoundException e) {
project = null;
if (project != null) {
project = gitHubBeforeAfter
.getProject(project.getId());
try {
project.delete();
project = null;
} catch (FileNotFoundException e) {
project = null;
}
}
}
}
Expand Down
41 changes: 24 additions & 17 deletions src/test/java/org/kohsuke/github/GHProjectColumnTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;

import java.io.FileNotFoundException;
Expand All @@ -10,14 +11,14 @@
/**
* @author Gunnar Skjold
*/
public class GHProjectColumnTest extends AbstractGitHubApiTestBase {
public class GHProjectColumnTest extends AbstractGitHubApiWireMockTest {
private GHProject project;
private GHProjectColumn column;

@Override public void setUp() throws Exception {
super.setUp();
@Before
public void setUp() throws Exception {
project = gitHub
.getOrganization("github-api-test-org")
.getOrganization(GITHUB_API_TEST_ORG)
.createProject("test-project", "This is a test project");
column = project.createColumn("column-one");
}
Expand Down Expand Up @@ -47,20 +48,26 @@ public void testDeleteColumn() throws IOException {

@After
public void after() throws IOException {
if(column != null) {
try {
column.delete();
column = null;
} catch (FileNotFoundException e) {
column = null;
if(githubApi.isUseProxy()) {
if (column != null) {
column = gitHubBeforeAfter
.getProjectColumn(column.getId());
try {
column.delete();
column = null;
} catch (FileNotFoundException e) {
column = null;
}
}
}
if(project != null) {
try {
project.delete();
project = null;
} catch (FileNotFoundException e) {
project = null;
if (project != null) {
project = gitHubBeforeAfter
.getProject(project.getId());
try {
project.delete();
project = null;
} catch (FileNotFoundException e) {
project = null;
}
}
}
}
Expand Down
25 changes: 15 additions & 10 deletions src/test/java/org/kohsuke/github/GHProjectTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;

import java.io.FileNotFoundException;
Expand All @@ -13,11 +14,11 @@
public class GHProjectTest extends AbstractGitHubApiTestBase {
private GHProject project;

@Override public void setUp() throws Exception {
super.setUp();
@Before
public void setUp() throws Exception {
project = gitHub
.getOrganization("github-api-test-org")
.createProject("test-project", "This is a test project");
.getOrganization(GITHUB_API_TEST_ORG)
.createProject("test-project", "This is a test project");
}

@Test
Expand Down Expand Up @@ -68,12 +69,16 @@ public void testDeleteProject() throws IOException {

@After
public void after() throws IOException {
if(project != null) {
try {
project.delete();
project = null;
} catch (FileNotFoundException e) {
project = null;
if (githubApi.isUseProxy()) {
if (project != null) {
project = gitHubBeforeAfter
.getProject(project.getId());
try {
project.delete();
project = null;
} catch (FileNotFoundException e) {
project = null;
}
}
}
}
Expand Down

0 comments on commit d787359

Please sign in to comment.