Last active
December 25, 2015 22:05
-
-
Save brianm/5cd6618facd4eb6c41a3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.skife.muckery.jackson; | |
import com.fasterxml.jackson.core.JsonParser; | |
import com.fasterxml.jackson.databind.MappingIterator; | |
import com.fasterxml.jackson.databind.ObjectMapper; | |
import org.junit.Test; | |
import static org.assertj.core.api.Assertions.assertThat; | |
public class ObjectStreamTest { | |
@Test | |
public void testFoo() throws Exception { | |
ObjectMapper mapper = new ObjectMapper(); | |
String json = "[{\"a\":0},{\"a\":1},{\"a\":2}]"; | |
MappingIterator<Thing> itty = mapper.readerFor(Thing.class).readValues(json); | |
Thing zero = itty.next(); | |
assertThat(zero.a).isEqualTo(0); | |
Thing one = itty.next(); | |
assertThat(one.a).isEqualTo(1); | |
Thing two = itty.next(); | |
assertThat(two.a).isEqualTo(2); | |
assertThat(itty.hasNext()).isFalse(); | |
} | |
public static class Thing | |
{ | |
public int a; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment