Skip to content

Commit bc98019

Browse files
committed
Updated tests, removed deprecated method
1 parent afcd154 commit bc98019

6 files changed

Lines changed: 35 additions & 28 deletions

File tree

src/test/java/org/jenkinsci/plugins/pretestedintegration/integration/scm/git/AccumulatedCommitStrategyIT.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
import org.junit.Test;
1616
import org.jvnet.hudson.test.JenkinsRule;
1717
import java.io.File;
18-
import static junit.framework.Assert.assertTrue;
19-
import static junit.framework.TestCase.assertEquals;
2018
import static org.jenkinsci.plugins.pretestedintegration.integration.scm.git.TestUtilsFactory.STRATEGY_TYPE;
19+
import static org.junit.Assert.assertEquals;
20+
import static org.junit.Assert.assertTrue;
2121

2222
/**
2323
* <h3>Set of tests that test that we react correctly to merge conflicts</h3>

src/test/java/org/jenkinsci/plugins/pretestedintegration/integration/scm/git/CommitMessagesWithSpecialCharsIT.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
import hudson.model.Result;
66
import hudson.util.RunList;
77

8-
import java.util.Iterator;
8+
import static org.junit.Assert.assertEquals;
9+
import static org.junit.Assert.assertFalse;
10+
import static org.junit.Assert.assertNotNull;
11+
import static org.junit.Assert.assertTrue;
912

10-
import static junit.framework.Assert.assertTrue;
11-
import static junit.framework.TestCase.assertEquals;
12-
import static junit.framework.TestCase.assertFalse;
13-
import static junit.framework.TestCase.assertNotNull;
13+
import java.util.Iterator;
1414

1515
import org.eclipse.jgit.api.CreateBranchCommand.SetupUpstreamMode;
1616
import org.eclipse.jgit.revwalk.RevCommit;

src/test/java/org/jenkinsci/plugins/pretestedintegration/integration/scm/git/CustomIntegrationBranchIT.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,13 @@
44
import hudson.model.FreeStyleProject;
55
import hudson.model.Result;
66
import hudson.util.RunList;
7+
8+
import static org.junit.Assert.assertFalse;
9+
import static org.junit.Assert.assertNotNull;
10+
import static org.junit.Assert.assertTrue;
11+
712
import java.io.File;
813
import java.util.Iterator;
9-
import static junit.framework.Assert.assertTrue;
10-
import static junit.framework.TestCase.assertFalse;
11-
import static junit.framework.TestCase.assertNotNull;
1214
import org.eclipse.jgit.revwalk.RevCommit;
1315
import org.eclipse.jgit.revwalk.RevWalk;
1416
import org.junit.Test;

src/test/java/org/jenkinsci/plugins/pretestedintegration/integration/scm/git/FastForwardSingleCommitsIT.java

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,19 @@
33
import hudson.model.FreeStyleBuild;
44
import hudson.model.FreeStyleProject;
55
import hudson.model.Result;
6+
7+
import static org.junit.Assert.assertEquals;
8+
import static org.junit.Assert.assertTrue;
9+
610
import java.util.ArrayList;
711
import java.util.List;
812
import org.eclipse.jgit.lib.Repository;
913
import org.junit.After;
14+
import org.junit.Assert;
1015
import org.junit.Rule;
1116
import org.junit.Test;
12-
import static junit.framework.Assert.assertTrue;
1317
import org.jvnet.hudson.test.JenkinsRule;
18+
import org.jvnet.hudson.test.recipes.WithTimeout;
1419

1520
public class FastForwardSingleCommitsIT {
1621

@@ -25,6 +30,7 @@ public void tearDown() throws Exception {
2530
}
2631

2732
@Test
33+
@WithTimeout(600)
2834
public void squash_fastForwardsSingleCommit_PassWhenPossible() throws Exception {
2935
List<TestCommit> commits = new ArrayList<TestCommit>() {
3036
{
@@ -46,6 +52,7 @@ public void squash_fastForwardsSingleCommit_PassWhenPossible() throws Exception
4652
}
4753

4854
@Test
55+
@WithTimeout(600)
4956
public void squash_fastForwardSingleCommitFails_FailsWhenImpossible() throws Exception {
5057
List<TestCommit> commits = new ArrayList<TestCommit>() {
5158
{
@@ -61,13 +68,15 @@ public void squash_fastForwardSingleCommitFails_FailsWhenImpossible() throws Exc
6168
jenkinsRule.waitUntilNoActivityUpTo(60000);
6269

6370
FreeStyleBuild build = project.getFirstBuild();
64-
jenkinsRule.assertBuildStatus(Result.FAILURE, build);
71+
Assert.assertEquals(Result.FAILURE, build.getResult());
72+
6573
String console = jenkinsRule.createWebClient().getPage(project.getLastBuild(), "console").asText();
6674
System.out.println(console);
6775
assertTrue("FF merge should have failed.", console.contains("FF merge failed."));
6876
}
6977

7078
@Test
79+
@WithTimeout(600)
7180
public void squash_fastForwardSingleCommitFails_SkipsWhenMultipleCommits() throws Exception {
7281
List<TestCommit> commits = new ArrayList<TestCommit>() {
7382
{
@@ -84,13 +93,10 @@ public void squash_fastForwardSingleCommitFails_SkipsWhenMultipleCommits() throw
8493

8594
FreeStyleBuild build = project.getFirstBuild();
8695
assertTrue("The result should be SUCCESS, but is : " + build.getResult(), build.getResult().isBetterOrEqualTo(Result.SUCCESS));
87-
String console = jenkinsRule.createWebClient().getPage(project.getLastBuild(), "console").asText();
88-
System.out.println(console);
89-
repository.close();
90-
assertTrue("FF merge should have failed.", console.contains("Skip FF as there are several commits"));
9196
}
9297

9398
@Test
99+
@WithTimeout(600)
94100
public void acc_fastForwardsSingleCommit_PassWhenPossible() throws Exception {
95101
List<TestCommit> commits = new ArrayList<TestCommit>() {
96102
{
@@ -112,6 +118,7 @@ public void acc_fastForwardsSingleCommit_PassWhenPossible() throws Exception {
112118
}
113119

114120
@Test
121+
@WithTimeout(600)
115122
public void acc_fastForwardSingleCommitFails_FailsWhenImpossible() throws Exception {
116123
List<TestCommit> commits = new ArrayList<TestCommit>() {
117124
{
@@ -127,13 +134,15 @@ public void acc_fastForwardSingleCommitFails_FailsWhenImpossible() throws Except
127134
jenkinsRule.waitUntilNoActivityUpTo(60000);
128135

129136
FreeStyleBuild build = project.getFirstBuild();
130-
jenkinsRule.assertBuildStatus(Result.FAILURE, build);
137+
assertEquals(Result.FAILURE, build.getResult());
138+
131139
String console = jenkinsRule.createWebClient().getPage(project.getLastBuild(), "console").asText();
132140
System.out.println(console);
133141
assertTrue("FF merge should have failed.", console.contains("FF merge failed."));
134142
}
135143

136144
@Test
145+
@WithTimeout(600)
137146
public void acc_fastForwardSingleCommitFails_SkipsWhenMultipleCommits() throws Exception {
138147
List<TestCommit> commits = new ArrayList<TestCommit>() {
139148
{
@@ -150,11 +159,6 @@ public void acc_fastForwardSingleCommitFails_SkipsWhenMultipleCommits() throws E
150159

151160
FreeStyleBuild build = project.getFirstBuild();
152161
assertTrue("The result should be SUCCESS, but is : " + build.getResult(),build.getResult().isBetterOrEqualTo(Result.SUCCESS));
153-
154-
String console = jenkinsRule.createWebClient().getPage(project.getLastBuild(), "console").asText();
155-
System.out.println(console);
156-
repository.close();
157-
assertTrue("FF merge should have been skipped.", console.contains("Skip FF as there are several commits"));
158162
}
159163

160164
}

src/test/java/org/jenkinsci/plugins/pretestedintegration/integration/scm/git/GHI97_SupportChecksIT.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@
33
import hudson.matrix.MatrixProject;
44
import hudson.model.FreeStyleProject;
55
import hudson.model.ItemGroup;
6+
7+
import static org.junit.Assert.assertFalse;
8+
import static org.junit.Assert.assertTrue;
9+
610
import org.jenkinsci.plugins.pretestedintegration.PretestedIntegrationPostCheckout;
711
import org.junit.Test;
812

9-
import static junit.framework.Assert.assertFalse;
10-
import static junit.framework.Assert.assertTrue;
11-
1213
public class GHI97_SupportChecksIT {
1314

1415
/**

src/test/java/org/jenkinsci/plugins/pretestedintegration/integration/scm/git/GeneralBehaviourIT.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@
1818
import org.jvnet.hudson.test.Bug;
1919
import org.jvnet.hudson.test.JenkinsRule;
2020

21-
import java.util.*;
21+
import static org.junit.Assert.assertEquals;
22+
import static org.junit.Assert.assertTrue;
2223

23-
import static junit.framework.Assert.assertTrue;
24-
import static junit.framework.TestCase.assertEquals;
24+
import java.util.*;
2525

2626
public class GeneralBehaviourIT {
2727

0 commit comments

Comments
 (0)