aboutsummaryrefslogtreecommitdiffhomepage
path: root/conformance/ConformanceJava.java
diff options
context:
space:
mode:
authorGravatar Josh Haberman <jhaberman@gmail.com>2015-07-10 16:36:59 -0700
committerGravatar Josh Haberman <jhaberman@gmail.com>2015-07-10 16:36:59 -0700
commitb0500b37b231b8f93a5b1b95e23d13830e11eb07 (patch)
treeda6aab20d86574dee821130e36741d02ccfd83c2 /conformance/ConformanceJava.java
parentfe50044041e8b8bc6b8d8183e8d043ed6dba403e (diff)
Added support for Json and valid input to conformance tests.
This was enabled by the recent open-sourcing of JSON support and MessageDifferencer. MessageDifferencer allows the conformance suite to expand because it allows us to write tests for payloads that parse successfully. To verify the testee's output payload, we need to parse it back into a message and compare the message instances. Comparing output bytes vs. a golden message is *not* valid, because protobufs do not have a canonical encoding (especially in the presence of maps, which have no prescribed serialization order). We only add one small JSON test for now, but with the framework in place we now have the foundation to dramatically expand the coverage of the conformance test suite. Also added the ability for the testee to skip tests that exercise features that are unimplemented. This allows Java (which currently has no JSON support) to skip tests involving JSON. Change-Id: I697b4363da432b61ae3b638b4287c4cda1af4deb
Diffstat (limited to 'conformance/ConformanceJava.java')
-rw-r--r--conformance/ConformanceJava.java6
1 files changed, 3 insertions, 3 deletions
diff --git a/conformance/ConformanceJava.java b/conformance/ConformanceJava.java
index c1a53141..25646b85 100644
--- a/conformance/ConformanceJava.java
+++ b/conformance/ConformanceJava.java
@@ -54,7 +54,7 @@ class ConformanceJava {
break;
}
case JSON_PAYLOAD: {
- return Conformance.ConformanceResponse.newBuilder().setRuntimeError("JSON not yet supported.").build();
+ return Conformance.ConformanceResponse.newBuilder().setSkipped("JSON not yet supported.").build();
}
case PAYLOAD_NOT_SET: {
throw new RuntimeException("Request didn't have payload.");
@@ -65,7 +65,7 @@ class ConformanceJava {
}
}
- switch (request.getRequestedOutput()) {
+ switch (request.getRequestedOutputFormat()) {
case UNSPECIFIED:
throw new RuntimeException("Unspecified output format.");
@@ -73,7 +73,7 @@ class ConformanceJava {
return Conformance.ConformanceResponse.newBuilder().setProtobufPayload(testMessage.toByteString()).build();
case JSON:
- return Conformance.ConformanceResponse.newBuilder().setRuntimeError("JSON not yet supported.").build();
+ return Conformance.ConformanceResponse.newBuilder().setSkipped("JSON not yet supported.").build();
default: {
throw new RuntimeException("Unexpected request output.");