### Question:
S3Task implements Task { @Override public void execute(Context ctx) throws Exception { Result r = delegate(ctx).execute(TaskParams.of(new ContextVariables(ctx), defaults)); ObjectMapper om = new ObjectMapper(); ctx.setVariable("result", om.convertValue(r, Map.class)); }  @Override void execute(Context ctx);  }### Answer:
@Test @SuppressWarnings("unchecked") public void test() throws Exception { String data = "Hello!"; Path p = Files.createTempFile("test", ".txt"); Files.write(p, data.getBytes()); Map<String, Object> auth = new HashMap<>(); auth.put("accessKey", System.getenv("AWS_ACCESS_KEY")); auth.put("secretKey", System.getenv("AWS_SECRET_KEY")); Map<String, Object> args = new HashMap<>(); args.put(com.walmartlabs.concord.sdk.Constants.Context.WORK_DIR_KEY, p.getParent().toAbsolutePath().toString()); args.put(ACTION_KEY, TaskParams.Action.PUTOBJECT.name()); args.put(PutObjectParams.BUCKET_NAME_KEY, "ibodrov-test"); args.put(PutObjectParams.OBJECT_KEY, "xyz"); args.put(PutObjectParams.SRC_KEY, p.getFileName().toString()); args.put(PutObjectParams.ENDPOINT_KEY, System.getenv("AWS_ENDPOINT")); args.put(PutObjectParams.REGION_KEY, System.getenv("AWS_REGION")); args.put(PutObjectParams.PATH_STYLE_ACCESS_KEY, true); args.put(PutObjectParams.AUTH_KEY, Collections.singletonMap("basic", auth)); MockContext ctx = new MockContext(args); Task t = new S3Task(); t.execute(ctx); Map<String, Object> r = (Map<String, Object>) ctx.getVariable(Constants.RESULT_KEY); assertTrue((Boolean) r.get("ok")); args.put(Constants.ACTION_KEY, TaskParams.Action.GETOBJECT.name()); ctx = new MockContext(args); t.execute(ctx); r = (Map<String, Object>) ctx.getVariable(Constants.RESULT_KEY); assertTrue((Boolean) r.get("ok")); String storedObject = (String) r.get("path"); String s = new String(Files.readAllBytes(p.getParent().resolve(storedObject))); assertEquals(data, s); }