@Test(expected = SignerException.class) public void testCall() throws Exception { Project project = mock(Project.class); ExtensionContainer container = new DefaultConvention(); when(project.getExtensions()).thenReturn(container); new JsignGradlePlugin().apply(project); Map<String, String> params = new HashMap<>(); params.put("file", "wineyes.exe"); params.put("name", "WinEyes"); Closure closure = (Closure) container.getByName("jsign"); closure.call(params); }
@Override public void apply(final Project project) { project.getExtensions().add("jsign", new Closure(null) { public void doCall(Map<String, String> params) throws SignerException { String file = params.get("file"); params.remove("file"); SignerHelper helper = new SignerHelper(new GradleConsole(project.getLogger()), "property"); for (Map.Entry<String, String> param : params.entrySet()) { helper.param(param.getKey(), param.getValue()); } helper.sign(new File(file)); } }); }
JsignGradlePlugin implements Plugin<Project> { @Override public void apply(final Project project) { project.getExtensions().add("jsign", new Closure(null) { public void doCall(Map<String, String> params) throws SignerException { String file = params.get("file"); params.remove("file"); SignerHelper helper = new SignerHelper(new GradleConsole(project.getLogger()), "property"); for (Map.Entry<String, String> param : params.entrySet()) { helper.param(param.getKey(), param.getValue()); } helper.sign(new File(file)); } }); } }
JsignGradlePlugin implements Plugin<Project> { @Override public void apply(final Project project) { project.getExtensions().add("jsign", new Closure(null) { public void doCall(Map<String, String> params) throws SignerException { String file = params.get("file"); params.remove("file"); SignerHelper helper = new SignerHelper(new GradleConsole(project.getLogger()), "property"); for (Map.Entry<String, String> param : params.entrySet()) { helper.param(param.getKey(), param.getValue()); } helper.sign(new File(file)); } }); }  }
JsignGradlePlugin implements Plugin<Project> { @Override public void apply(final Project project) { project.getExtensions().add("jsign", new Closure(null) { public void doCall(Map<String, String> params) throws SignerException { String file = params.get("file"); params.remove("file"); SignerHelper helper = new SignerHelper(new GradleConsole(project.getLogger()), "property"); for (Map.Entry<String, String> param : params.entrySet()) { helper.param(param.getKey(), param.getValue()); } helper.sign(new File(file)); } }); }  @Override void apply(final Project project); }
JsignGradlePlugin implements Plugin<Project> { @Override public void apply(final Project project) { project.getExtensions().add("jsign", new Closure(null) { public void doCall(Map<String, String> params) throws SignerException { String file = params.get("file"); params.remove("file"); SignerHelper helper = new SignerHelper(new GradleConsole(project.getLogger()), "property"); for (Map.Entry<String, String> param : params.entrySet()) { helper.param(param.getKey(), param.getValue()); } helper.sign(new File(file)); } }); }  @Override void apply(final Project project);  }