forked from json-iterator/java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTestBoolean.java
More file actions
28 lines (24 loc) · 989 Bytes
/
TestBoolean.java
File metadata and controls
28 lines (24 loc) · 989 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package com.jsoniter;
import junit.framework.TestCase;
import java.io.ByteArrayInputStream;
import java.io.IOException;
public class TestBoolean extends TestCase {
@org.junit.experimental.categories.Category(StreamingCategory.class)
public void test_streaming() throws IOException {
JsonIterator iter = JsonIterator.parse(new ByteArrayInputStream("[true,false,null,true]".getBytes()), 3);
iter.readArray();
assertTrue(iter.readBoolean());
iter.readArray();
assertFalse(iter.readBoolean());
iter.readArray();
assertTrue(iter.readNull());
iter.readArray();
assertTrue(iter.readBoolean());
}
public void test_non_streaming() throws IOException {
assertTrue(JsonIterator.parse("true").readBoolean());
assertFalse(JsonIterator.parse("false").readBoolean());
assertTrue(JsonIterator.parse("null").readNull());
assertFalse(JsonIterator.parse("false").readNull());
}
}