本文整理汇总了Java中io.takari.maven.testing.TestResources类的典型用法代码示例。如果您正苦于以下问题:Java TestResources类的具体用法?Java TestResources怎么用?Java TestResources使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TestResources类属于io.takari.maven.testing包,在下文中一共展示了TestResources类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testPackageMultimodule
import io.takari.maven.testing.TestResources; //导入依赖的package包/类
@Test
public void testPackageMultimodule() throws Exception {
File basedir = resources.getBasedir("basic");
maven.forProject(basedir)
.execute("package") //
.assertErrorFreeLog();
File targetdir = new File(basedir, "target");
assertThat(targetdir).exists().isDirectory();
TestResources.assertFilesPresent(targetdir,
"classes/com/salesforce/aptspring/ComputerHardwareConfiguration_forceInjectData.class");
TestResources.assertFilesPresent(targetdir,
"generated-sources/annotations/com/salesforce/aptspring/ComputerHardwareConfiguration_forceInjectData.java");
TestResources.assertFilesPresent(targetdir,
"test-classes/com/salesforce/aptspring/RootApplicationConfiguration_forceInjectData.class");
TestResources.assertFilesPresent(targetdir,
"generated-test-sources/test-annotations/com/salesforce/aptspring/RootApplicationConfiguration_forceInjectData.java");
}
示例2: AbstractTest
import io.takari.maven.testing.TestResources; //导入依赖的package包/类
public AbstractTest(MavenRuntime.MavenRuntimeBuilder mavenBuilder, String projectName)
throws Exception {
this.resources =
new TestResources(
"src/test/projects",
Files.createTempDirectory("maven-git-code-format-test").toString());
this.maven = mavenBuilder.withCliOptions("-B", "-U").build();
this.projectName = projectName;
}
示例3: testBasic
import io.takari.maven.testing.TestResources; //导入依赖的package包/类
@Test
public void testBasic() throws Exception {
File basedir = resources.getBasedir("basic");
String goal = format("io.codearte.props2yaml:props2yaml-maven-plugin:%s:convert", properties.getPluginVersion());
maven.forProject(basedir)
.execute(goal, "-Dproperties=sample.properties")
.assertErrorFreeLog();
TestResources.assertFilesPresent(basedir, "sample.yml");
}
示例4: testCustomTestPropertiesFile
import io.takari.maven.testing.TestResources; //导入依赖的package包/类
@Test
public void testCustomTestPropertiesFile() throws Exception {
File basedir = resources.getBasedir("testproperties/custom-test-properties-file");
MavenProject project = mojos.readMavenProject(basedir);
MavenSession session = mojos.newMavenSession(project);
mojos.executeMojo(session, project, newMojoExecution());
Assert.assertEquals("value", readProperties(basedir).get("custom"));
TestResources.cp(basedir, "src/test/modified-test.properties", "src/test/test.properties");
mojos.executeMojo(session, project, newMojoExecution());
Assert.assertEquals("modified-value", readProperties(basedir).get("custom"));
}
示例5: testWorkspaceStateIncludesThisProjectJarArtifact
import io.takari.maven.testing.TestResources; //导入依赖的package包/类
@Test
public void testWorkspaceStateIncludesThisProjectJarArtifact() throws Exception {
File basedir = resources.getBasedir();
MavenProject project = mojos.readMavenProject(basedir);
MavenSession session = mojos.newMavenSession(project);
mojos.executeMojo(session, project, newMojoExecution());
Map<String, String> state = TestResources.readProperties(basedir, "target/workspacestate.properties");
Assert.assertEquals(new File(basedir, "pom.xml").getCanonicalPath(), state.get("test:test:pom::1"));
Assert.assertEquals(new File(basedir, "target/classes").getCanonicalPath(), state.get("test:test:jar::1"));
}
示例6: test
import io.takari.maven.testing.TestResources; //导入依赖的package包/类
private void test(String compilerId) throws Exception {
File basedir = resources.getBasedir("compile-proc");
MavenExecutionResult result = verifier.forProject(basedir).withCliOption("-DcompilerId=" + compilerId).execute("package");
result.assertErrorFreeLog();
TestResources.assertFilesPresent(basedir, "project/target/classes/project/MyMyAnnotationClient.class");
}
示例7: readProperties
import io.takari.maven.testing.TestResources; //导入依赖的package包/类
private Map<String, String> readProperties(File basedir) throws IOException {
return TestResources.readProperties(basedir, "target/test-classes/test.properties");
}