Finishing touches on JsonElementWriter
This commit is contained in:
parent
349c01e861
commit
70abd0ba87
@ -58,6 +58,9 @@ public final class JsonElementWriter extends JsonWriter {
|
|||||||
super(UNWRITABLE_WRITER);
|
super(UNWRITABLE_WRITER);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the top level object produced by this writer.
|
||||||
|
*/
|
||||||
public JsonElement get() {
|
public JsonElement get() {
|
||||||
if (!stack.isEmpty()) {
|
if (!stack.isEmpty()) {
|
||||||
throw new IllegalStateException("Expected one JSON element but was " + stack);
|
throw new IllegalStateException("Expected one JSON element but was " + stack);
|
||||||
|
@ -21,9 +21,6 @@ import java.io.IOException;
|
|||||||
import junit.framework.TestCase;
|
import junit.framework.TestCase;
|
||||||
|
|
||||||
public final class JsonElementWriterTest extends TestCase {
|
public final class JsonElementWriterTest extends TestCase {
|
||||||
|
|
||||||
// TODO: figure out what should be returned by an empty writer
|
|
||||||
|
|
||||||
public void testArray() throws IOException {
|
public void testArray() throws IOException {
|
||||||
JsonElementWriter writer = new JsonElementWriter();
|
JsonElementWriter writer = new JsonElementWriter();
|
||||||
writer.beginArray();
|
writer.beginArray();
|
||||||
|
Loading…
Reference in New Issue
Block a user