This is an automated email from the ASF dual-hosted git repository.

mgrigorov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/avro.git


The following commit(s) were added to refs/heads/master by this push:
     new f7ba38f2f AVRO-2560: Convert tests to JUnit 5 (#2287)
f7ba38f2f is described below

commit f7ba38f2f63b751a2839d23f1424165695a6dcbf
Author: Ryan Skraba <[email protected]>
AuthorDate: Wed Jun 14 22:04:00 2023 +0200

    AVRO-2560: Convert tests to JUnit 5 (#2287)
---
 .../avro/src/test/java/org/apache/avro/TestSchema.java     | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/lang/java/avro/src/test/java/org/apache/avro/TestSchema.java 
b/lang/java/avro/src/test/java/org/apache/avro/TestSchema.java
index f77e1d91d..1abc98101 100644
--- a/lang/java/avro/src/test/java/org/apache/avro/TestSchema.java
+++ b/lang/java/avro/src/test/java/org/apache/avro/TestSchema.java
@@ -413,16 +413,16 @@ public class TestSchema {
     assertEquals("Int", nameInt.getQualified("space"));
   }
 
-  @Test(expected = SchemaParseException.class)
-  public void testContentAfterAvsc() throws Exception {
+  @Test
+  void testContentAfterAvsc() throws Exception {
     Schema.Parser parser = new Schema.Parser();
     parser.setValidate(true);
     parser.setValidateDefaults(true);
-    parser.parse("{\"type\": \"string\"}; DROP TABLE STUDENTS");
+    assertThrows(SchemaParseException.class, () -> parser.parse("{\"type\": 
\"string\"}; DROP TABLE STUDENTS"));
   }
 
   @Test
-  public void testContentAfterAvscInInputStream() throws Exception {
+  void testContentAfterAvscInInputStream() throws Exception {
     Schema.Parser parser = new Schema.Parser();
     parser.setValidate(true);
     parser.setValidateDefaults(true);
@@ -432,8 +432,8 @@ public class TestSchema {
     assertNotNull(schema);
   }
 
-  @Test(expected = SchemaParseException.class)
-  public void testContentAfterAvscInFile() throws Exception {
+  @Test
+  void testContentAfterAvscInFile() throws Exception {
     File avscFile = Files.createTempFile("testContentAfterAvscInFile", 
null).toFile();
     try (FileWriter writer = new FileWriter(avscFile)) {
       writer.write("{\"type\": \"string\"}; DROP TABLE STUDENTS");
@@ -443,6 +443,6 @@ public class TestSchema {
     Schema.Parser parser = new Schema.Parser();
     parser.setValidate(true);
     parser.setValidateDefaults(true);
-    parser.parse(avscFile);
+    assertThrows(SchemaParseException.class, () -> parser.parse(avscFile));
   }
 }

Reply via email to