This is an automated email from the ASF dual-hosted git repository. veithen pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/ws-axiom.git
The following commit(s) were added to refs/heads/master by this push: new ac81da254 Use assertThrows ac81da254 is described below commit ac81da254c0d2ecef66da0953c2be023f4205972 Author: Andreas Veithen <andreas.veit...@gmail.com> AuthorDate: Fri Nov 4 18:53:22 2022 +0000 Use assertThrows --- .../org/apache/axiom/mime/ContentTypeTest.java | 50 ++++------------------ 1 file changed, 8 insertions(+), 42 deletions(-) diff --git a/axiom-api/src/test/java/org/apache/axiom/mime/ContentTypeTest.java b/axiom-api/src/test/java/org/apache/axiom/mime/ContentTypeTest.java index 6883b83ac..f58cde6f6 100644 --- a/axiom-api/src/test/java/org/apache/axiom/mime/ContentTypeTest.java +++ b/axiom-api/src/test/java/org/apache/axiom/mime/ContentTypeTest.java @@ -19,6 +19,7 @@ package org.apache.axiom.mime; import static com.google.common.truth.Truth.assertThat; +import static org.junit.Assert.assertThrows; import java.text.ParseException; @@ -72,66 +73,31 @@ public class ContentTypeTest extends TestCase { } public void testParseInvalid1() { - try { - new ContentType("text/xml; ?"); - fail("Expected ParseException"); - } catch (ParseException ex) { - // Expected - } + assertThrows(ParseException.class, () -> { new ContentType("text/xml; ?"); }); } public void testParseInvalid2() { - try { - new ContentType("text/"); - fail("Expected ParseException"); - } catch (ParseException ex) { - // Expected - } + assertThrows(ParseException.class, () -> { new ContentType("text/"); }); } public void testParseInvalid3() { - try { - new ContentType("text/xml; charset="); - fail("Expected ParseException"); - } catch (ParseException ex) { - // Expected - } + assertThrows(ParseException.class, () -> { new ContentType("text/xml; charset="); }); } public void testParseInvalid4() { - try { - new ContentType("text/xml; charset=\"asc"); - fail("Expected ParseException"); - } catch (ParseException ex) { - // Expected - } + assertThrows(ParseException.class, () -> { new ContentType("text/xml; charset=\"asc"); }); } public void testParseInvalid5() { - try { - new ContentType("text/xml; param=\"test\\"); - fail("Expected ParseException"); - } catch (ParseException ex) { - // Expected - } + assertThrows(ParseException.class, () -> { new ContentType("text/xml; param=\"test\\"); }); } public void testParseInvalid6() { - try { - new ContentType("text/xml; param;"); - fail("Expected ParseException"); - } catch (ParseException ex) { - // Expected - } + assertThrows(ParseException.class, () -> { new ContentType("text/xml; param;"); }); } public void testParseInvalid7() { - try { - new ContentType("text/xml; param"); - fail("Expected ParseException"); - } catch (ParseException ex) { - // Expected - } + assertThrows(ParseException.class, () -> { new ContentType("text/xml; param"); }); } public void testToString() {