Skip to content

Commit b97d235

Browse files
ahornaceVladimir Kotal
authored andcommitted
Update junit to 5.7.0
1 parent 53c21ad commit b97d235

File tree

10 files changed

+19
-32
lines changed

10 files changed

+19
-32
lines changed

opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/LangMapTest.java

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,10 @@
2323
package org.opengrok.indexer.analysis;
2424

2525
import static org.junit.Assert.assertArrayEquals;
26+
import static org.junit.Assert.assertThrows;
2627
import static org.junit.Assert.assertTrue;
2728

28-
import org.junit.Rule;
2929
import org.junit.Test;
30-
import org.junit.rules.ExpectedException;
3130

3231
import java.util.List;
3332
import java.util.Map;
@@ -38,9 +37,6 @@
3837
*/
3938
public class LangMapTest {
4039

41-
@Rule
42-
public ExpectedException thrown = ExpectedException.none();
43-
4440
@Test
4541
public void testEmptyMap() {
4642
LangMap map = new LangTreeMap();
@@ -168,43 +164,38 @@ public void testAddExtensionThenExclude() {
168164
public void testBadExtensionFileSpec() {
169165
LangMap map = new LangTreeMap();
170166

171-
thrown.expect(IllegalArgumentException.class);
172-
map.add(".c.in", "foo");
167+
assertThrows(IllegalArgumentException.class, () -> map.add(".c.in", "foo"));
173168
}
174169

175170
@Test
176171
public void testImmutabilityOfUnmodifiable1() {
177172
LangMap map = new LangTreeMap();
178173
LangMap map2 = map.unmodifiable();
179174

180-
thrown.expect(UnsupportedOperationException.class);
181-
map2.add(".FOO", "foo");
175+
assertThrows(UnsupportedOperationException.class, () -> map2.add(".FOO", "foo"));
182176
}
183177

184178
@Test
185179
public void testImmutabilityOfUnmodifiable2() {
186180
LangMap map = new LangTreeMap();
187181
LangMap map2 = map.unmodifiable();
188182

189-
thrown.expect(UnsupportedOperationException.class);
190-
map2.exclude(".FOO");
183+
assertThrows(UnsupportedOperationException.class, () -> map2.exclude(".FOO"));
191184
}
192185

193186
@Test
194187
public void testImmutabilityOfAdditionsView() {
195188
LangMap map = new LangTreeMap();
196189
Map<String, String> additions = map.getAdditions();
197190

198-
thrown.expect(UnsupportedOperationException.class);
199-
additions.clear();
191+
assertThrows(UnsupportedOperationException.class, additions::clear);
200192
}
201193

202194
@Test
203195
public void testImmutabilityOfExclusionsView() {
204196
LangMap map = new LangTreeMap();
205197
Set<String> exclusions = map.getExclusions();
206198

207-
thrown.expect(UnsupportedOperationException.class);
208-
exclusions.clear();
199+
assertThrows(UnsupportedOperationException.class, exclusions::clear);
209200
}
210201
}

opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/clojure/ClojureAnalyzerFactoryTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
*/
1919

2020
/*
21-
* Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
21+
* Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
2222
* Portions Copyright (c) 2017, 2019, Chris Fraire <[email protected]>.
2323
*/
2424
package org.opengrok.indexer.analysis.clojure;
@@ -42,7 +42,7 @@
4242
import java.io.InputStream;
4343
import java.io.StringWriter;
4444
import static org.hamcrest.CoreMatchers.is;
45-
import static org.junit.Assert.assertThat;
45+
import static org.hamcrest.MatcherAssert.assertThat;
4646
import static org.junit.Assert.assertTrue;
4747
import static org.junit.Assert.fail;
4848

opengrok-indexer/src/test/java/org/opengrok/indexer/analysis/pascal/PascalAnalyzerFactoryTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
*/
1919

2020
/*
21-
* Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
21+
* Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
2222
* Portions Copyright (c) 2017, 2019, Chris Fraire <[email protected]>.
2323
*/
2424
package org.opengrok.indexer.analysis.pascal;
@@ -32,8 +32,9 @@
3232
import org.apache.lucene.document.Field;
3333
import static org.hamcrest.CoreMatchers.is;
3434
import org.junit.AfterClass;
35+
36+
import static org.hamcrest.MatcherAssert.assertThat;
3537
import static org.junit.Assert.assertNotNull;
36-
import static org.junit.Assert.assertThat;
3738
import static org.junit.Assert.assertTrue;
3839
import static org.junit.Assert.fail;
3940
import org.junit.BeforeClass;
@@ -129,7 +130,6 @@ public void testAnalyzer() throws Exception {
129130
assertThat(type[0], is("function"));
130131
assertTrue(definitions.hasDefinitionAt("TSample.GetUser", 63, type));
131132
assertThat(type[0], is("function"));
132-
133133
}
134134

135135
}

opengrok-indexer/src/test/java/org/opengrok/indexer/history/BitKeeperRepositoryTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@
2424

2525
import static org.hamcrest.CoreMatchers.equalTo;
2626
import static org.hamcrest.CoreMatchers.not;
27+
import static org.hamcrest.MatcherAssert.assertThat;
2728
import static org.junit.Assert.assertEquals;
2829
import static org.junit.Assert.assertNotNull;
2930
import static org.junit.Assert.assertNull;
30-
import static org.junit.Assert.assertThat;
3131
import static org.junit.Assert.assertTrue;
3232

3333
import java.io.File;

opengrok-indexer/src/test/java/org/opengrok/indexer/util/BooleanUtilTest.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,10 @@
2020
package org.opengrok.indexer.util;
2121

2222
import org.junit.Assert;
23-
import org.junit.Rule;
2423
import org.junit.Test;
25-
import org.junit.rules.ExpectedException;
2624

2725
public class BooleanUtilTest {
2826

29-
@Rule public final ExpectedException thrown = ExpectedException.none();
30-
3127
// Test written by Diffblue Cover.
3228
@Test
3329
public void isBooleanInputNotNullOutputFalse() {

opengrok-indexer/src/test/java/org/opengrok/indexer/web/UtilTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@
4343
import org.junit.Test;
4444
import org.opengrok.indexer.util.PlatformUtils;
4545

46+
import static org.hamcrest.MatcherAssert.assertThat;
4647
import static org.hamcrest.collection.IsIterableContainingInOrder.contains;
4748
import static org.junit.Assert.assertEquals;
4849
import static org.junit.Assert.assertFalse;
4950
import static org.junit.Assert.assertNull;
50-
import static org.junit.Assert.assertThat;
5151
import static org.junit.Assert.assertTrue;
5252

5353
/**

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ Portions Copyright (c) 2018, 2020, Chris Fraire <[email protected]>.
7272
https://eclipse-ee4j.github.io/jersey.github.io/release-notes/2.30.1.html
7373
reads that Jersey 2.30.1 did "adopt Jackson 2.10.1." -->
7474
<jackson.version>2.10.1</jackson.version>
75-
<junit.version>5.4.2</junit.version>
75+
<junit.version>5.7.0</junit.version>
7676
<maven-surefire.version>2.22.2</maven-surefire.version>
7777
<apache-commons-lang3.version>3.9</apache-commons-lang3.version>
7878
<micrometer.version>1.5.4</micrometer.version>

suggester/src/test/java/org/opengrok/suggest/SuggesterUtilsTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
*/
1919

2020
/*
21-
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
21+
* Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved.
2222
*/
2323
package org.opengrok.suggest;
2424

@@ -34,11 +34,11 @@
3434
import java.util.Arrays;
3535
import java.util.List;
3636

37+
import static org.hamcrest.MatcherAssert.assertThat;
3738
import static org.hamcrest.collection.IsIterableContainingInAnyOrder.containsInAnyOrder;
3839
import static org.hamcrest.collection.IsIterableContainingInOrder.contains;
3940
import static org.junit.Assert.assertEquals;
4041
import static org.junit.Assert.assertFalse;
41-
import static org.junit.Assert.assertThat;
4242

4343
public class SuggesterUtilsTest {
4444

suggester/src/test/java/org/opengrok/suggest/popular/impl/ChronicleMapAdapterTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
*/
1919

2020
/*
21-
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
21+
* Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved.
2222
*/
2323
package org.opengrok.suggest.popular.impl;
2424

@@ -35,9 +35,9 @@
3535
import java.util.List;
3636
import java.util.Map.Entry;
3737

38+
import static org.hamcrest.MatcherAssert.assertThat;
3839
import static org.hamcrest.collection.IsIterableContainingInOrder.contains;
3940
import static org.junit.Assert.assertEquals;
40-
import static org.junit.Assert.assertThat;
4141

4242
public class ChronicleMapAdapterTest {
4343

suggester/src/test/java/org/opengrok/suggest/query/customized/CustomSloppyPhraseScorerTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@
4747
import java.util.HashSet;
4848
import java.util.Set;
4949

50+
import static org.hamcrest.MatcherAssert.assertThat;
5051
import static org.hamcrest.collection.IsIterableContainingInOrder.contains;
51-
import static org.junit.Assert.assertThat;
5252

5353
public class CustomSloppyPhraseScorerTest {
5454

0 commit comments

Comments
 (0)