Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kurtakov2020-08-06 07:19:07 +0000
committerAlexander Kurtakov2020-08-06 07:36:34 +0000
commit49f6874448bc0310931b285f81ae68321386ebae (patch)
tree66bcb76d5f76d2602d2dbf0c7afd8a91ab7deeb4
parent5cbc294116ce896cc6d4651c579f0b389a1b251b (diff)
downloadeclipse.platform.text-49f6874448bc0310931b285f81ae68321386ebae.tar.gz
eclipse.platform.text-49f6874448bc0310931b285f81ae68321386ebae.tar.xz
eclipse.platform.text-49f6874448bc0310931b285f81ae68321386ebae.zip
Use assertThrows rather than ExpectedException.
Which is deprecated. Change-Id: I75b27bc0ca5c93effedf5a68d6297ff81a00cf1b Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
-rw-r--r--org.eclipse.text.tests/src/org/eclipse/text/tests/MultiStringMatcherTest.java14
1 files changed, 4 insertions, 10 deletions
diff --git a/org.eclipse.text.tests/src/org/eclipse/text/tests/MultiStringMatcherTest.java b/org.eclipse.text.tests/src/org/eclipse/text/tests/MultiStringMatcherTest.java
index 54a5bbeed40..22217f8f982 100644
--- a/org.eclipse.text.tests/src/org/eclipse/text/tests/MultiStringMatcherTest.java
+++ b/org.eclipse.text.tests/src/org/eclipse/text/tests/MultiStringMatcherTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2019 Thomas Wolf and others.
+ * Copyright (c) 2019, 2020 Thomas Wolf and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -13,22 +13,18 @@ package org.eclipse.text.tests;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertThrows;
import java.util.Collections;
import java.util.List;
-import org.junit.Rule;
import org.junit.Test;
-import org.junit.rules.ExpectedException;
import org.eclipse.jface.text.MultiStringMatcher;
import org.eclipse.jface.text.MultiStringMatcher.Match;
public class MultiStringMatcherTest {
- @Rule
- public ExpectedException thrown = ExpectedException.none();
-
private static Match run(String text, String... needles) {
return run(text, 0, needles);
}
@@ -444,16 +440,14 @@ public class MultiStringMatcherTest {
public void addAfterBuild() throws Exception {
MultiStringMatcher.Builder b = MultiStringMatcher.builder().add("he", "she").add("his", "hers");
b.build();
- thrown.expect(IllegalStateException.class);
- b.add("us");
+ assertThrows(IllegalStateException.class, () -> b.add("us"));
}
@Test
public void reuseBuilder() throws Exception {
MultiStringMatcher.Builder b = MultiStringMatcher.builder().add("he", "she").add("his", "hers");
b.build();
- thrown.expect(IllegalStateException.class);
- b.build();
+ assertThrows(IllegalStateException.class, () -> b.build());
}
@Test

Back to the top