- Add the Codota plugin to your IDE and get smart completions
private void myMethod () {OutputStreamWriter o =
OutputStream out;new OutputStreamWriter(out)
OutputStream out;String charsetName;new OutputStreamWriter(out, charsetName)
HttpURLConnection connection;new OutputStreamWriter(connection.getOutputStream())
- Smart code suggestions by Codota
}
@Override @Nonnull public String toGroovy(@Nonnull EnvironmentDirective directive) { StringBuilder result = new StringBuilder("environment {\n"); if (!directive.getEnv().isEmpty()) { for (NameAndValue e : directive.getEnv()) { result.append(e.name).append(" = "); result.append("\"").append(e.getValue()).append("\"\n"); } } else { result.append("// No environment variables specified\n"); } result.append("}\n"); return result.toString(); }
@Test public void environment() throws Exception { List<EnvironmentDirective.NameAndValue> envList = new ArrayList<>(); envList.add(new EnvironmentDirective.NameAndValue("BOB", "steve")); envList.add(new EnvironmentDirective.NameAndValue("WHAT", "${BOB} says hi")); EnvironmentDirective env = new EnvironmentDirective(envList); assertGenerateDirective(env, "environment {\n" + " BOB = \"steve\"\n" + " WHAT = \"${BOB} says hi\"\n" + "}"); }
envList.add(new EnvironmentDirective.NameAndValue("BOB", "steve")); envList.add(new EnvironmentDirective.NameAndValue("WHAT", "${BOB} says hi")); EnvironmentDirective env = new EnvironmentDirective(envList); PostDirective post = new PostDirective(Arrays.asList("always", "unstable")); List<DeclarativeStageConditional<?>> nested = new ArrayList<>();