summaryrefslogtreecommitdiffstats
path: root/vespaclient-container-plugin/src/test/java/com/yahoo/document/restapi/resource/MockedOperationHandler.java
diff options
context:
space:
mode:
authorTor Brede Vekterli <vekterli@oath.com>2018-02-08 17:43:02 +0100
committerTor Brede Vekterli <vekterli@oath.com>2018-02-08 17:43:02 +0100
commit6961959b71f84f2cece6538d8c5c6bed9871dc8c (patch)
tree7ae4247d398e731d4bdd465ed1fb9732ec9aa597 /vespaclient-container-plugin/src/test/java/com/yahoo/document/restapi/resource/MockedOperationHandler.java
parentde59b17780e0a205dc91c36bb8338f0482229be4 (diff)
Also support fieldSet for Document V1 get operations
Now has parity with visit operations and the legacy API.
Diffstat (limited to 'vespaclient-container-plugin/src/test/java/com/yahoo/document/restapi/resource/MockedOperationHandler.java')
-rw-r--r--vespaclient-container-plugin/src/test/java/com/yahoo/document/restapi/resource/MockedOperationHandler.java11
1 files changed, 9 insertions, 2 deletions
diff --git a/vespaclient-container-plugin/src/test/java/com/yahoo/document/restapi/resource/MockedOperationHandler.java b/vespaclient-container-plugin/src/test/java/com/yahoo/document/restapi/resource/MockedOperationHandler.java
index 3b16d9a378c..297576f1bef 100644
--- a/vespaclient-container-plugin/src/test/java/com/yahoo/document/restapi/resource/MockedOperationHandler.java
+++ b/vespaclient-container-plugin/src/test/java/com/yahoo/document/restapi/resource/MockedOperationHandler.java
@@ -55,9 +55,16 @@ public class MockedOperationHandler implements OperationHandler {
}
@Override
- public Optional<String> get(RestUri restUri) throws RestApiException {
+ public Optional<String> get(RestUri restUri, Optional<String> fieldSet) throws RestApiException {
log.append("GET: " + restUri.generateFullId());
- return Optional.empty();
+ // This is _not_ an elegant way to return data back to the test.
+ // An alternative is removing this entire class in favor of explicit mock expectations.
+ return fieldSet.map(fs -> String.format("{\"fields\": {\"fieldset\": \"%s\"}}", fs));
+ }
+
+ @Override
+ public Optional<String> get(RestUri restUri) throws RestApiException {
+ return get(restUri, Optional.empty());
}
}