CreateServerOptions implements MapBinder { public CreateServerOptions withFile(String path, byte[] contents) { checkState(files.size() < 5, "maximum number of files allowed is 5"); files.add(new File(path, contents)); return this; }  @Override R bindToRequest(R request, Map<String, Object> postParams); CreateServerOptions withFile(String path, byte[] contents); CreateServerOptions withSharedIpGroup(int id); CreateServerOptions withMetadata(Map<String, String> metadata); CreateServerOptions withSharedIp(String publicIp); @Override R bindToRequest(R request, Object input);  }
@Test public void testWithFile() { CreateServerOptions options = new CreateServerOptions(); options.withFile("/tmp/rhubarb", "foo".getBytes()); HttpRequest request = buildRequest(options); assertFile(request); }
@Test public void testWithFileStatic() { CreateServerOptions options = withFile("/tmp/rhubarb", "foo".getBytes()); HttpRequest request = buildRequest(options); assertFile(request); }