Skip to content

Commit cc44fd0

Browse files
author
TheSnoozer
committed
stop using deprecated methods
1 parent d3a3425 commit cc44fd0

File tree

2 files changed

+14
-15
lines changed

2 files changed

+14
-15
lines changed

maven/src/test/java/pl/project13/maven/git/AheadBehindTest.java

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,11 @@
1717

1818
package pl.project13.maven.git;
1919

20-
import static org.junit.Assert.assertThat;
21-
2220
import java.io.File;
2321

2422
import org.eclipse.jgit.api.Git;
2523
import org.eclipse.jgit.lib.ConfigConstants;
2624
import org.eclipse.jgit.lib.StoredConfig;
27-
import org.hamcrest.CoreMatchers;
2825
import org.junit.After;
2926
import org.junit.Before;
3027
import org.junit.Rule;
@@ -33,6 +30,8 @@
3330
import pl.project13.core.AheadBehind;
3431
import pl.project13.core.GitProvider;
3532

33+
import static org.junit.Assert.assertEquals;
34+
3635
public abstract class AheadBehindTest<T extends GitProvider> {
3736

3837
@Rule
@@ -87,8 +86,8 @@ protected void extraSetup() {
8786
public void shouldNotBeAheadOrBehind() throws Exception {
8887

8988
AheadBehind aheadBehind = gitProvider.getAheadBehind();
90-
assertThat(aheadBehind.ahead(), CoreMatchers.is("0"));
91-
assertThat(aheadBehind.behind(), CoreMatchers.is("0"));
89+
assertEquals(aheadBehind.ahead(), "0");
90+
assertEquals(aheadBehind.behind(), "0");
9291
}
9392

9493
@Test
@@ -97,8 +96,8 @@ public void shouldBe1Ahead() throws Exception {
9796
createLocalCommit();
9897

9998
AheadBehind aheadBehind = gitProvider.getAheadBehind();
100-
assertThat(aheadBehind.ahead(), CoreMatchers.is("1"));
101-
assertThat(aheadBehind.behind(), CoreMatchers.is("0"));
99+
assertEquals(aheadBehind.ahead(),"1");
100+
assertEquals(aheadBehind.behind(),"0");
102101
}
103102

104103
@Test
@@ -107,8 +106,8 @@ public void shouldBe1Behind() throws Exception {
107106
createCommitInSecondRepoAndPush();
108107

109108
AheadBehind aheadBehind = gitProvider.getAheadBehind();
110-
assertThat(aheadBehind.ahead(), CoreMatchers.is("0"));
111-
assertThat(aheadBehind.behind(), CoreMatchers.is("1"));
109+
assertEquals(aheadBehind.ahead(),"0");
110+
assertEquals(aheadBehind.behind(),"1");
112111
}
113112

114113
@Test
@@ -118,8 +117,8 @@ public void shouldBe1AheadAnd1Behind() throws Exception {
118117
createCommitInSecondRepoAndPush();
119118

120119
AheadBehind aheadBehind = gitProvider.getAheadBehind();
121-
assertThat(aheadBehind.ahead(), CoreMatchers.is("1"));
122-
assertThat(aheadBehind.behind(), CoreMatchers.is("1"));
120+
assertEquals(aheadBehind.ahead(),"1");
121+
assertEquals(aheadBehind.behind(),"1");
123122
}
124123

125124
protected void createLocalCommit() throws Exception {

maven/src/test/java/pl/project13/maven/git/GitCommitIdMojoIntegrationTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ public void shouldNotUseBuildEnvironmentBranchInfoWhenParameterSet(boolean useNa
287287
// reset repo and force detached HEAD
288288
try (final Git git = git("my-jar-project")) {
289289
git.reset().setMode(ResetCommand.ResetType.HARD).setRef("b6a73ed").call();
290-
git.checkout().setCreateBranch(true).setName("test_branch").setForce(true).call();
290+
git.checkout().setCreateBranch(true).setName("test_branch").setForceRefUpdate(true).call();
291291
}
292292

293293
// when
@@ -375,7 +375,7 @@ private void shouldUseJenkinsBranchInfoWhenAvailableHelperAndAssertBranch(boolea
375375
// reset repo and force detached HEAD
376376
try (final Git git = git("my-jar-project")) {
377377
git.reset().setMode(ResetCommand.ResetType.HARD).setRef("b6a73ed").call();
378-
git.checkout().setName("b6a73ed").setForce(true).call();
378+
git.checkout().setName("b6a73ed").setForceRefUpdate(true).call();
379379
}
380380

381381
// when
@@ -1527,8 +1527,8 @@ public void verifyEvalOnCommitWithTwoBranches(boolean useNativeGit) throws Excep
15271527
// 2343428 - Moved master - Fri, 29 Nov 2013 10:38:34 +0100 (HEAD, branch: master)
15281528
try (final Git git = git("my-jar-project")) {
15291529
git.reset().setMode(ResetCommand.ResetType.HARD).setRef("2343428").call();
1530-
git.checkout().setCreateBranch(true).setName("another_branch").setForce(true).call();
1531-
git.checkout().setCreateBranch(true).setName("z_branch").setForce(true).call();
1530+
git.checkout().setCreateBranch(true).setName("another_branch").setForceRefUpdate(true).call();
1531+
git.checkout().setCreateBranch(true).setName("z_branch").setForceRefUpdate(true).call();
15321532
}
15331533

15341534
mojo.useNativeGit = useNativeGit;

0 commit comments

Comments
 (0)