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

rskraba pushed a commit to branch branch-1.11
in repository https://gitbox.apache.org/repos/asf/avro.git


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

commit 66d4cff7e93bc73dd7ff7e905f92f594d61227ea
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 a4e2718cc..f0a8d4ec0 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
@@ -399,16 +399,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);
@@ -418,8 +418,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");
@@ -429,6 +429,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