Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e9685e0

Browse files
committed
Relaxes ArchTests requirements
1 parent 21ffe16 commit e9685e0

File tree

2 files changed

+18
-7
lines changed

2 files changed

+18
-7
lines changed

src/test/java/org/kohsuke/github/ArchTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ public void testRequireUseOfAssertThat() {
141141
final String reason = "This project uses `assertThat(...)` instead of other `assert*()` methods.";
142142

143143
final DescribedPredicate<HasName> assertMethodOtherThanAssertThat = nameContaining("assert")
144-
.and(DescribedPredicate.not(name("assertThat")));
144+
.and(DescribedPredicate.not(name("assertThat")).or(DescribedPredicate.not(name("assertThrows"))));
145145

146146
final ArchRule onlyAssertThatRule = classes()
147147
.should(not(callMethodWhere(target(assertMethodOtherThanAssertThat))))

src/test/java/org/kohsuke/github/ReleaseTest.java

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
package org.kohsuke.github;
22

33
import org.junit.Test;
4-
import static org.junit.Assert.assertThrows;
54

65
import java.util.UUID;
76

87
import static org.hamcrest.Matchers.is;
98
import static org.hamcrest.Matchers.notNullValue;
9+
import static org.junit.Assert.assertThrows;
1010

1111
public class ReleaseTest extends AbstractGitHubWireMockTest {
1212

@@ -17,7 +17,11 @@ public void testCreateSimpleRelease() throws Exception {
1717
String tagName = UUID.randomUUID().toString();
1818
String releaseName = "release-" + tagName;
1919

20-
GHRelease release = repo.createRelease(tagName).name(releaseName).categoryName("announcements").prerelease(false).create();
20+
GHRelease release = repo.createRelease(tagName)
21+
.name(releaseName)
22+
.categoryName("announcements")
23+
.prerelease(false)
24+
.create();
2125

2226
GHRelease releaseCheck = repo.getRelease(release.getId());
2327

@@ -27,7 +31,7 @@ public void testCreateSimpleRelease() throws Exception {
2731
}
2832

2933
@Test
30-
public void testCreateDoubleReleaseFails() throws Exception{
34+
public void testCreateDoubleReleaseFails() throws Exception {
3135
GHRepository repo = gitHub.getRepository("hub4j-test-org/testCreateRelease");
3236

3337
String tagName = UUID.randomUUID().toString();
@@ -37,8 +41,9 @@ public void testCreateDoubleReleaseFails() throws Exception{
3741
GHRelease releaseCheck = repo.getRelease(release.getId());
3842
assertThat(releaseCheck, notNullValue());
3943

40-
HttpException httpException = assertThrows(
41-
HttpException.class, () -> {repo.createRelease(tagName).name(releaseName).create();});
44+
HttpException httpException = assertThrows(HttpException.class, () -> {
45+
repo.createRelease(tagName).name(releaseName).create();
46+
});
4247

4348
assertThat(httpException.getResponseCode(), is(422));
4449
}
@@ -50,7 +55,13 @@ public void testCreateReleaseWithUnknownCategoryFails() throws Exception {
5055
String tagName = UUID.randomUUID().toString();
5156
String releaseName = "release-" + tagName;
5257

53-
assertThrows(GHFileNotFoundException.class, () -> { repo.createRelease(tagName).name(releaseName).categoryName("an invalid cateogry").prerelease(false).create(); });
58+
assertThrows(GHFileNotFoundException.class, () -> {
59+
repo.createRelease(tagName)
60+
.name(releaseName)
61+
.categoryName("an invalid cateogry")
62+
.prerelease(false)
63+
.create();
64+
});
5465
}
5566

5667
}

0 commit comments

Comments
 (0)