org.gradle.api.tasks.testing.Test.useJUnitPlatform()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(2.5k)|赞(0)|评价(0)|浏览(165)

本文整理了Java中org.gradle.api.tasks.testing.Test.useJUnitPlatform()方法的一些代码示例,展示了Test.useJUnitPlatform()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Test.useJUnitPlatform()方法的具体详情如下:
包路径:org.gradle.api.tasks.testing.Test
类名称:Test
方法名:useJUnitPlatform

Test.useJUnitPlatform介绍

暂无

代码示例

代码示例来源:origin: gradle.plugin.com.xenoterracide/gradle-junit

@Override
  public void apply( Project project ) {
    project.getTasks().withType( Test.class ).configureEach( task -> {
      task.useJUnitPlatform();
      task.testLogging( log -> log.info( info -> info.getEvents().add( TestLogEvent.PASSED ) ) );
      task.reports( reports -> {
        reports.getJunitXml().setEnabled( true );
        reports.getHtml().setEnabled( false );
      } );
    } );
  }
}

代码示例来源:origin: gradle.plugin.com.xenoterracide.gradle/gradle-plugin-bundle

@Override
  public void apply( Project project ) {
    project.getPluginManager().apply( JavaLibraryPlugin.class );
    DependencyHandler deps = project.getDependencies();
    deps.add( TEST_IMPL, String.join( D, Junit.G, Junit.Api.A ) );
    deps.add( TEST_IMPL, String.join( D, Junit.G, Junit.Param.A ) );
    deps.add( TEST_RUN, String.join( D, Junit.G, Junit.Engine.A ) );
    deps.add( TEST_IMPL, String.join( D, AssertJ.G, AssertJ.A ) );

    project.getTasks().withType( Test.class ).configureEach( task -> {
      task.useJUnitPlatform();
      task.testLogging( log -> log.info( info -> info.getEvents().add( TestLogEvent.PASSED ) ) );
      task.reports( reports -> {
        reports.getJunitXml().setEnabled( true );
        reports.getHtml().setEnabled( false );
      } );
    } );
  }
}

代码示例来源:origin: gradle.plugin.com.xenoterracide.gradle/pluginbundle

@Override
  public void apply( Project project ) {
    project.getPluginManager().apply( JavaLibraryPlugin.class );
    DependencyHandler deps = project.getDependencies();
    deps.add( TEST_IMPL, String.join( D, Junit.G, Junit.Api.A ) );
    deps.add( TEST_IMPL, String.join( D, Junit.G, Junit.Param.A ) );
    deps.add( TEST_RUN, String.join( D, Junit.G, Junit.Engine.A ) );
    deps.add( TEST_IMPL, String.join( D, AssertJ.G, AssertJ.A ) );

    project.getTasks().withType( Test.class ).configureEach( task -> {
      task.useJUnitPlatform();
      task.testLogging( log -> log.info( info -> info.getEvents().add( TestLogEvent.PASSED ) ) );
      task.reports( reports -> {
        reports.getJunitXml().setEnabled( true );
        reports.getHtml().setEnabled( false );
      } );
    } );
    project.getTasks().withType( JavaCompile.class ).configureEach( task -> {
      CompileOptions options = task.getOptions();
      options.setAnnotationProcessorGeneratedSourcesDirectory( Paths.get( "build/generated/src" ).toFile() );
      options.getCompilerArgs().addAll( Arrays.asList(
          "-parameters",
          "-Xlint:deprecation"
      ) );
    } );
  }
}

相关文章