当前位置: 首页>>代码示例>>Java>>正文


Java TestInfo类代码示例

本文整理汇总了Java中org.junit.jupiter.api.TestInfo的典型用法代码示例。如果您正苦于以下问题:Java TestInfo类的具体用法?Java TestInfo怎么用?Java TestInfo使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


TestInfo类属于org.junit.jupiter.api包,在下文中一共展示了TestInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: apply

import org.junit.jupiter.api.TestInfo; //导入依赖的package包/类
@Override
public MessageRequest apply(MessageRequest messageRequest, TestInfo testInfo) {
    checkArgument(testInfo.getTestClass().isPresent());
    checkArgument(testInfo.getTestMethod().isPresent());
    String methodName = testInfo.getTestMethod().get().getName();
    String className = testInfo.getTestClass().get().getSimpleName();
    String basicSummary = String.format("Called from %s within %s",
            methodName,
            className);
    return MessageRequest.builder()
            .from(messageRequest)
            .addAttachments(Attachment.builder()
                    .fallback(basicSummary)
                    .text(basicSummary)
                    .build())
            .build();
}
 
开发者ID:palantir,项目名称:roboslack,代码行数:18,代码来源:EnrichTestMessageRequest.java

示例2: testOne

import org.junit.jupiter.api.TestInfo; //导入依赖的package包/类
@Test
@DisplayName("My test")
@Tag("my-tag")
void testOne(TestInfo testInfo) {
    System.out.println(testInfo.getDisplayName());
    System.out.println(testInfo.getTags());
    System.out.println(testInfo.getTestClass());
    System.out.println(testInfo.getTestMethod());
}
 
开发者ID:bonigarcia,项目名称:mastering-junit5,代码行数:10,代码来源:TestInfoTest.java

示例3: test1

import org.junit.jupiter.api.TestInfo; //导入依赖的package包/类
@Test
@DisplayName("My test")
@Tag("my-tag")
void test1(TestInfo testInfo) {
    System.out.println(testInfo.getDisplayName());
    System.out.println(testInfo.getTags());
    System.out.println(testInfo.getTestClass());
    System.out.println(testInfo.getTestMethod());
}
 
开发者ID:PacktPublishing,项目名称:Mastering-Software-Testing-with-JUnit-5,代码行数:10,代码来源:TestInfoTest.java

示例4: testSendMessage

import org.junit.jupiter.api.TestInfo; //导入依赖的package包/类
@ParameterizedTest
@ArgumentsSource(MessageRequestProvider.class)
void testSendMessage(MessageRequest messageRequest, TestInfo testInfo) {
    assertThat(SlackWebHookService.with(assumingEnvironmentWebHookToken())
                    .sendMessage(EnrichTestMessageRequest.get().apply(messageRequest, testInfo)),
            is(equalTo(ResponseCode.OK)));
}
 
开发者ID:palantir,项目名称:roboslack,代码行数:8,代码来源:SlackWebHookServiceTests.java

示例5: junitAndSpringMethodInjectionCombined

import org.junit.jupiter.api.TestInfo; //导入依赖的package包/类
@Test
void junitAndSpringMethodInjectionCombined(@Autowired Cat kittyCat, TestInfo testInfo, ApplicationContext context,
		TestReporter testReporter) {

	assertNotNull(testInfo, "TestInfo should have been injected by JUnit");
	assertNotNull(testReporter, "TestReporter should have been injected by JUnit");

	assertNotNull(context, "ApplicationContext should have been injected by Spring");
	assertNotNull(kittyCat, "Cat should have been @Autowired by Spring");
}
 
开发者ID:sbrannen,项目名称:spring-test-junit5,代码行数:11,代码来源:SpringExtensionTests.java

示例6: SpringJUnit5ConstructorInjectionTests

import org.junit.jupiter.api.TestInfo; //导入依赖的package包/类
SpringJUnit5ConstructorInjectionTests(ApplicationContext applicationContext, @Autowired Person dilbert,
		@Autowired Dog dog, @Value("${enigma}") Integer enigma, TestInfo testInfo) {

	this.applicationContext = applicationContext;
	this.dilbert = dilbert;
	this.dog = dog;
	this.enigma = enigma;
	this.testInfo = testInfo;
}
 
开发者ID:sbrannen,项目名称:spring-test-junit5,代码行数:10,代码来源:SpringJUnit5ConstructorInjectionTests.java

示例7: test1

import org.junit.jupiter.api.TestInfo; //导入依赖的package包/类
@Test
@DisplayName("TEST 1")
@Tag("my-tag")
void test1(TestInfo testInfo) {
	assertEquals("TEST 1", testInfo.getDisplayName());
	assertTrue(testInfo.getTags().contains("my-tag"));
	assertTrue(TestHelper.getLastRecordedStateForVariable("testInfo") != null);
}
 
开发者ID:dodie,项目名称:scott,代码行数:9,代码来源:TestInfoTest.java

示例8: loadFromExternalFile

import org.junit.jupiter.api.TestInfo; //导入依赖的package包/类
@DataProvider
static Object[][] loadFromExternalFile(TestInfo testInfo, TestReporter testReporter) {
    checkNotNull(testInfo, "'testInfo' is not set");
    checkNotNull(testReporter, "'testReporter' is not set");

    String testDataFile = testInfo.getTestMethod().get().getAnnotation(ExternalFile.class).value();
    // Load the data from the external file here ...
    return new Object[][] { { testDataFile } };
}
 
开发者ID:TNG,项目名称:junit-dataprovider,代码行数:10,代码来源:DataProviderMethodParameterAcceptanceTest.java

示例9: testThree

import org.junit.jupiter.api.TestInfo; //导入依赖的package包/类
@ParameterizedTest
// @formatter:off
@DataProvider(value = {
        "2 | 3 | 2, 3",
        "c | d | c, d",
    }, splitBy = "\\|")
// @formatter:on
void testThree(String a, String b, String expected, TestInfo testInfo) {
    // Expect:
    assertThat(testInfo.getDisplayName()).contains(expected);
}
 
开发者ID:TNG,项目名称:junit-dataprovider,代码行数:12,代码来源:AdditionalTestMethodParameterAcceptanceTest.java

示例10: testDivide

import org.junit.jupiter.api.TestInfo; //导入依赖的package包/类
@TestTemplate
@UseDataProvider
void testDivide(int dividend, int divisor, int result, TestInfo testInfo) {
    // Expect:
    assertThat(dividend / divisor).isEqualTo(result);
    assertThat(testInfo.getDisplayName())
            .endsWith(String.format("dividend=%d, divisor=%d, result=%d", dividend, divisor, result));
}
 
开发者ID:TNG,项目名称:junit-dataprovider,代码行数:9,代码来源:FormatAcceptanceTest.java

示例11: testThree

import org.junit.jupiter.api.TestInfo; //导入依赖的package包/类
@TestTemplate
// @formatter:off
@DataProvider(value = {
        "2 | 3 | 2, 3",
        "c | d | c, d",
    }, splitBy = "\\|")
// @formatter:on
void testThree(String a, String b, String expected, TestInfo testInfo) {
    // Expect:
    assertThat(testInfo.getDisplayName()).contains(expected);
}
 
开发者ID:TNG,项目名称:junit-dataprovider,代码行数:12,代码来源:AdditionalTestMethodParameterAcceptanceTest.java

示例12: init

import org.junit.jupiter.api.TestInfo; //导入依赖的package包/类
@BeforeEach
void init(TestInfo testInfo) {
    String displayName = testInfo.getDisplayName();
    System.out.printf("@BeforeEach %s %n", displayName);
}
 
开发者ID:bonigarcia,项目名称:mastering-junit5,代码行数:6,代码来源:TestInfoTest.java

示例13: beforeEachTest

import org.junit.jupiter.api.TestInfo; //导入依赖的package包/类
@BeforeEach
default void beforeEachTest(TestInfo testInfo) {
    log.info("About to execute {}", testInfo.getDisplayName());
}
 
开发者ID:bonigarcia,项目名称:mastering-junit5,代码行数:5,代码来源:TestLifecycleLogger.java

示例14: afterEachTest

import org.junit.jupiter.api.TestInfo; //导入依赖的package包/类
@AfterEach
default void afterEachTest(TestInfo testInfo) {
    log.info("Finished executing {}", testInfo.getDisplayName());
}
 
开发者ID:bonigarcia,项目名称:mastering-junit5,代码行数:5,代码来源:TestLifecycleLogger.java

示例15: customDisplayName

import org.junit.jupiter.api.TestInfo; //导入依赖的package包/类
@RepeatedTest(value = 2, name = "{displayName} {currentRepetition}/{totalRepetitions}")
@DisplayName("Repeat!")
void customDisplayName(TestInfo testInfo) {
    System.out.println(testInfo.getDisplayName());
}
 
开发者ID:bonigarcia,项目名称:mastering-junit5,代码行数:6,代码来源:TunningDisplayInRepeatedTest.java


注:本文中的org.junit.jupiter.api.TestInfo类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。