@Test public void testBuild() { SProject sProject = Mockito.mock(SProject.class); ExtraParameters extraParameters = new ExtraParameters(); extraParameters.put("myString", "${buildId} is in project ${projectId}"); Context resolver = new WebHooksBeanUtilsVelocityVariableResolver( null, new WebHookPayloadContent.SimpleSerialiser(), new JavaBean("bt01", "project01", sProject), extraParameters, null ); WebHookVelocityVariableMessageBuilder builder = WebHookVelocityVariableMessageBuilder.create(resolver, null); assertEquals("bt01", builder.build("${buildId}")); assertEquals("project01", builder.build("${projectId}")); assertEquals("bt01 is in project project01", builder.build("${myString}")); }
@Override public String build(String template) { StringWriter swParse1 = new StringWriter(); this.ve.evaluate(resolver, swParse1, "WebHookVelocityVariableMessageBuilder", template); StringWriter swParse2 = new StringWriter(); this.ve.evaluate(resolver, swParse2, "WebHookVelocityVariableMessageBuilder", swParse1.toString()); return swParse2.toString(); }
WebHookVelocityVariableMessageBuilder implements VariableMessageBuilder { @Override public String build(String template) { StringWriter swParse1 = new StringWriter(); this.ve.evaluate(resolver, swParse1, "WebHookVelocityVariableMessageBuilder", template); StringWriter swParse2 = new StringWriter(); this.ve.evaluate(resolver, swParse2, "WebHookVelocityVariableMessageBuilder", swParse1.toString()); return swParse2.toString(); } }
WebHookVelocityVariableMessageBuilder implements VariableMessageBuilder { @Override public String build(String template) { StringWriter swParse1 = new StringWriter(); this.ve.evaluate(resolver, swParse1, "WebHookVelocityVariableMessageBuilder", template); StringWriter swParse2 = new StringWriter(); this.ve.evaluate(resolver, swParse2, "WebHookVelocityVariableMessageBuilder", swParse1.toString()); return swParse2.toString(); }  }
WebHookVelocityVariableMessageBuilder implements VariableMessageBuilder { @Override public String build(String template) { StringWriter swParse1 = new StringWriter(); this.ve.evaluate(resolver, swParse1, "WebHookVelocityVariableMessageBuilder", template); StringWriter swParse2 = new StringWriter(); this.ve.evaluate(resolver, swParse2, "WebHookVelocityVariableMessageBuilder", swParse1.toString()); return swParse2.toString(); }  static WebHookVelocityVariableMessageBuilder create(Context resolver, WebHookSecretResolver webHookSecretResolver); @Override String build(String template); }
WebHookVelocityVariableMessageBuilder implements VariableMessageBuilder { @Override public String build(String template) { StringWriter swParse1 = new StringWriter(); this.ve.evaluate(resolver, swParse1, "WebHookVelocityVariableMessageBuilder", template); StringWriter swParse2 = new StringWriter(); this.ve.evaluate(resolver, swParse2, "WebHookVelocityVariableMessageBuilder", swParse1.toString()); return swParse2.toString(); }  static WebHookVelocityVariableMessageBuilder create(Context resolver, WebHookSecretResolver webHookSecretResolver); @Override String build(String template);  }