Skip to content

Commit

Permalink
Merge pull request #10 from noahra/issue/#3
Browse files Browse the repository at this point in the history
test - fix added assertion (#3)
closes #3
  • Loading branch information
lnsandnkth authored Mar 2, 2022
2 parents 0d893a4 + da40903 commit 6927007
Showing 1 changed file with 8 additions and 1 deletion.
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

0 comments on commit 6927007

Please sign in to comment.