From da40903f7e7e59c09448f30ab4136168f96b5269 Mon Sep 17 00:00:00 2001 From: lnsandn <98472625+lnsandnkth@users.noreply.github.com> Date: Wed, 2 Mar 2022 11:32:55 +0100 Subject: [PATCH] test - fix added assertion (#3) test - fix added assertion (#3) --- src/test/java/com/jsoniter/TestRecord.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/test/java/com/jsoniter/TestRecord.java b/src/test/java/com/jsoniter/TestRecord.java index 8e70a4e3..ddf50b96 100644 --- a/src/test/java/com/jsoniter/TestRecord.java +++ b/src/test/java/com/jsoniter/TestRecord.java @@ -1,10 +1,12 @@ package com.jsoniter; import com.jsoniter.output.JsonStream; +import com.jsoniter.spi.JsonException; import junit.framework.Test; import junit.framework.TestCase; import java.io.IOException; +import java.util.Arrays; public class TestRecord extends TestCase { @@ -15,7 +17,12 @@ record TestRecord1(long field1) { public void test_record_error() throws IOException { JsonIterator iter = JsonIterator.parse("{ 'field1' : 1".replace('\'', '"')); - iter.read(TestRecord1.class); + try{ + TestRecord1 rec = iter.read(TestRecord1.class); + assertEquals(1, rec.field1); + }catch (JsonException e) { + throw new JsonException("no constructor for: class com.jsoniter.TestRecord", e); + } } public void test_record_serialize(){