private void assertFileContents(ProjectGeneratorConfiguration generatorConfiguration, Path actualFilePath, String expectedFileName) throws URISyntaxException, IOException { URL resource = null; String overridePath = generatorConfiguration.getTemplates().getOverridePath(); String methodName = testName.getMethodName(); int index = methodName.indexOf('['); if (index != -1) { methodName = methodName.substring(0, index); } if (!StringUtils.isEmpty(overridePath)) { resource = ProjectGeneratorTest.class.getResource(methodName + "/" + overridePath + "/" + expectedFileName); } if (resource == null) { resource = ProjectGeneratorTest.class.getResource(methodName + "/" + expectedFileName); } if (resource == null) { throw new IllegalArgumentException("Unable to find te required resource (" + expectedFileName + ")"); } final String actual = new String(Files.readAllBytes(actualFilePath), StandardCharsets.UTF_8).trim(); final String expected = new String(Files.readAllBytes(Paths.get(resource.toURI())), StandardCharsets.UTF_8).trim(); assertThat(actual).isEqualTo(expected); }
protected void assertFileContents(ProjectGeneratorConfiguration generatorConfiguration, Path actualFilePath, String expectedFileName) throws URISyntaxException, IOException { URL resource = null; String overridePath = generatorConfiguration.getTemplates().getOverridePath(); String methodName = testName.getMethodName(); int index = methodName.indexOf('['); if (index != -1) { methodName = methodName.substring(0, index); } if (!StringUtils.isEmpty(overridePath)) { resource = ProjectGeneratorTest.class.getResource(methodName + "/" + overridePath + "/" + expectedFileName); } if (resource == null) { resource = ProjectGeneratorTest.class.getResource(methodName + "/" + expectedFileName); } if (resource == null) { throw new IllegalArgumentException("Unable to find te required resource (" + expectedFileName + ")"); } final String actual = new String(Files.readAllBytes(actualFilePath), StandardCharsets.UTF_8).trim(); final String expected = new String(Files.readAllBytes(Paths.get(resource.toURI())), StandardCharsets.UTF_8).trim(); assertThat(actual).isEqualTo(expected); }
private void assertFileContentsJson(ProjectGeneratorConfiguration generatorConfiguration, Path actualFilePath, String expectedFileName) throws URISyntaxException, IOException, JSONException { URL resource = null; String overridePath = generatorConfiguration.getTemplates().getOverridePath(); String methodName = testName.getMethodName(); int index = methodName.indexOf('['); if (index != -1) { methodName = methodName.substring(0, index); } if (!StringUtils.isEmpty(overridePath)) { resource = ProjectGeneratorTest.class.getResource(methodName + "/" + overridePath + "/" + expectedFileName); } if (resource == null) { resource = ProjectGeneratorTest.class.getResource(methodName + "/" + expectedFileName); } if (resource == null) { throw new IllegalArgumentException("Unable to find te required resource (" + expectedFileName + ")"); } final String actual = new String(Files.readAllBytes(actualFilePath), StandardCharsets.UTF_8).trim(); final String expected = new String(Files.readAllBytes(Paths.get(resource.toURI())), StandardCharsets.UTF_8).trim(); JSONAssert.assertEquals(expected, actual, JSONCompareMode.STRICT); }
configuration.getTemplates().setOverridePath(this.basePath); configuration.getTemplates().getAdditionalResources().addAll(this.additionalResources); configuration.setSecretMaskingEnabled(true);
configuration.getTemplates().setOverridePath(this.basePath); configuration.getTemplates().getAdditionalResources().addAll(this.additionalResources); configuration.setSecretMaskingEnabled(true);
configuration.getMavenProperties().addRepository("jboss.ea", "https://repository.jboss.org/nexus/content/groups/ea"); configuration.getTemplates().setOverridePath(this.basePath); configuration.getTemplates().getAdditionalResources().addAll(this.additionalResources); configuration.setSecretMaskingEnabled(true);