Skip to content

test - fix added assertion (#3) #10

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 2, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/test/java/com/jsoniter/TestRecord.java
Original file line number Diff line number Diff line change
@@ -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 {

Expand All @@ -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(){
Expand Down