Skip to content

Commit

Permalink
Tiny test addition
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Apr 10, 2021
1 parent 71c6eed commit 0e10dc4
Showing 1 changed file with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;

import java.io.ByteArrayInputStream;
import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import java.util.List;
Expand Down Expand Up @@ -208,12 +209,20 @@ public void testSimpleRectangle() throws Exception
+"bottomRight.y = 10\n"
, new String(toml, StandardCharsets.UTF_8));

Rectangle result = MAPPER.readerFor(Rectangle.class)
.readValue(toml);
Rectangle result;

// Read first from static byte[]
result = MAPPER.readerFor(Rectangle.class)
.readValue(toml);
assertNotNull(result.topLeft);
assertNotNull(result.bottomRight);
assertEquals(input, result);

// and then via InputStream
result = MAPPER.readerFor(Rectangle.class)
.readValue(new ByteArrayInputStream(toml));
assertNotNull(result.topLeft);
assertNotNull(result.bottomRight);
assertEquals(input, result);
}

Expand Down

0 comments on commit 0e10dc4

Please sign in to comment.