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


Java Assumptions.assumeTrue方法代码示例

本文整理汇总了Java中org.junit.jupiter.api.Assumptions.assumeTrue方法的典型用法代码示例。如果您正苦于以下问题:Java Assumptions.assumeTrue方法的具体用法?Java Assumptions.assumeTrue怎么用?Java Assumptions.assumeTrue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.junit.jupiter.api.Assumptions的用法示例。


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

示例1: updateGreeting

import org.junit.jupiter.api.Assumptions; //导入方法依赖的package包/类
@Test
@DisplayName("Updating a greeting should work")
void updateGreeting() {
    // Given we have a greeting already saved
    GreetingDto savedGreeting = service.createGreeting(createGreetingDto("We come in peace!"));
    Assumptions.assumeTrue(savedGreeting != null);
    // When we update it
    savedGreeting.setMessage("Updated message");
    service.updateGreetingWithId(savedGreeting.getId(), savedGreeting);
    // Then it should be updated
    Optional<GreetingDto> updatedGreetingOptional = service.findGreetingById(savedGreeting.getId());
    Assertions.assertAll("Updating a greeting by id should work",
            () -> assertTrue(updatedGreetingOptional.isPresent(), "Could not find greeting by id"),
            () -> assertEquals(savedGreeting.getId(), updatedGreetingOptional.get().getId(), "Updated greeting has invalid id"),
            () -> assertEquals("Updated message", updatedGreetingOptional.get().getMessage(), "Updated greeting has different message from the expected updated one"));

}
 
开发者ID:bmariesan,项目名称:iStudent,代码行数:18,代码来源:GreetingServiceTest.java

示例2: testDefaultValidityFailedValidationExecutorRemovesValidityStackFrames

import org.junit.jupiter.api.Assumptions; //导入方法依赖的package包/类
@Test
void testDefaultValidityFailedValidationExecutorRemovesValidityStackFrames() {
    Exception exception = new NullPointerException();
    Assumptions.assumeTrue(null != exception.getStackTrace() && exception.getStackTrace().length > 0,
                           "This test can only work if the JVM is filling in stack traces.");
    IllegalArgumentException thrown = Assertions.assertThrows(IllegalArgumentException.class,
                                                              () -> FVE.fail("expected", "subject", () -> "message"));
    int firstLineNumber = exception.getStackTrace()[0].getLineNumber();
    Assertions.assertTrue(null != thrown.getStackTrace() && thrown.getStackTrace().length > 0,
                          "If the JVM is filling in stack traces the thrown exception should have a stack trace.");
    Assertions.assertEquals(firstLineNumber + 4,
                            thrown.getStackTrace()[0].getLineNumber(),
                            "Default stack trace should have the caller as the first line number.");
    Assertions.assertEquals(exception.getStackTrace()[0].getClassName(),
                            thrown.getStackTrace()[0].getClassName(),
                            "Default stack trace should have the caller as the first line");
    Assertions.assertTrue(thrown.getStackTrace().length > 1,
                          "Default stack trace should have more than the caller.");
}
 
开发者ID:redfin,项目名称:validity,代码行数:20,代码来源:StackTraceTest.java

示例3: testSubmissionApiPostSuccess

import org.junit.jupiter.api.Assumptions; //导入方法依赖的package包/类
@Test
void testSubmissionApiPostSuccess() throws IOException {
	HttpResponse httpResponse = servicePost(qpp);
	Assumptions.assumeTrue(endpointIsUp(httpResponse), "Validation api is down");

	assertThat(getStatus(httpResponse)).isEqualTo(200);
}
 
开发者ID:CMSgov,项目名称:qpp-conversion-tool,代码行数:8,代码来源:SubmissionIntegrationTest.java

示例4: testSubmissionApiPostFailure

import org.junit.jupiter.api.Assumptions; //导入方法依赖的package包/类
@Test
@SuppressWarnings("unchecked")
void testSubmissionApiPostFailure() throws IOException {
	Map<String, Object> obj = (Map<String, Object>) qpp.getObject();
	obj.remove("performanceYear");
	HttpResponse httpResponse = servicePost(qpp);
	Assumptions.assumeTrue(endpointIsUp(httpResponse), "Validation api is down");

	assertWithMessage("QPP submission should be unprocessable")
			.that(getStatus(httpResponse))
			.isEqualTo(422);
}
 
开发者ID:CMSgov,项目名称:qpp-conversion-tool,代码行数:13,代码来源:SubmissionIntegrationTest.java

示例5: commonSetUp

import org.junit.jupiter.api.Assumptions; //导入方法依赖的package包/类
@BeforeEach
public void commonSetUp() {
    settingsBuilder = TrautePluginSettingsBuilder.settingsBuilder();
    expectCompilationResult = CompilationResultExpectationBuilder.expectCompilationResult();
    expectRunResult = RunResultExpectationBuilder.expectRunResult();

    Assumptions.assumeTrue(Boolean.getBoolean(ACTIVATION_PROPERTY));
}
 
开发者ID:denis-zhdanov,项目名称:traute,代码行数:9,代码来源:AbstractTrauteTest.java

示例6: testFromEnvironment

import org.junit.jupiter.api.Assumptions; //导入方法依赖的package包/类
@Test
void testFromEnvironment() {
    List<String> keysMissingFromEnvironment = WebHookToken.Env.missingTokenKeys();
    Assumptions.assumeTrue(keysMissingFromEnvironment.isEmpty(),
            () -> String.format("Skipping test, environment keys not found: [%s]",
                    Joiner.on(", ").join(keysMissingFromEnvironment)));
    WebHookToken token = WebHookToken.fromEnvironment();
    Assertions.assertFalse(Strings.isNullOrEmpty(token.partB()));
    Assertions.assertFalse(Strings.isNullOrEmpty(token.partT()));
    Assertions.assertFalse(Strings.isNullOrEmpty(token.partX()));
    Assertions.assertFalse(Strings.isNullOrEmpty(token.toString()));
}
 
开发者ID:palantir,项目名称:roboslack,代码行数:13,代码来源:WebHookTokenTests.java

示例7: findGreetingById

import org.junit.jupiter.api.Assumptions; //导入方法依赖的package包/类
@Test
@DisplayName("Retrieving a greeting by id should work")
void findGreetingById() {
    // Given we have a greeting already saved
    GreetingDto savedGreeting = service.createGreeting(createGreetingDto("We come in peace!"));
    Assumptions.assumeTrue(savedGreeting != null);
    // When we try to retrieve it
    Optional<GreetingDto> greetingByIdOptional = service.findGreetingById(savedGreeting.getId());
    // Then it should be there
    Assertions.assertAll("Retrieving a greeting by id should work",
            () -> assertTrue(greetingByIdOptional.isPresent(), "Could not find greeting by id"),
            () -> assertEquals(savedGreeting.getId(), greetingByIdOptional.get().getId(), "Retrieved greeting has invalid id"),
            () -> assertEquals(savedGreeting.getMessage(), greetingByIdOptional.get().getMessage(), "Retrieved greeting has different message from the saved one"));

}
 
开发者ID:bmariesan,项目名称:iStudent,代码行数:16,代码来源:GreetingServiceTest.java

示例8: deleteGreetingById

import org.junit.jupiter.api.Assumptions; //导入方法依赖的package包/类
@Test
@DisplayName("Removing a greeting by id should work")
void deleteGreetingById() {
    // Given we have a greeting already saved
    GreetingDto savedGreeting = service.createGreeting(createGreetingDto("We come in peace!"));
    Assumptions.assumeTrue(savedGreeting != null);
    // When we delete it
    service.deleteGreetingById(savedGreeting.getId());
    // Then it should be removed
    Optional<GreetingDto> deletedGreetingOptional = service.findGreetingById(savedGreeting.getId());
    Assertions.assertAll("Removing a greeting by id should work",
            () -> assertFalse(deletedGreetingOptional.isPresent(), "Found greeting by id when it should be deleted"));

}
 
开发者ID:bmariesan,项目名称:iStudent,代码行数:15,代码来源:GreetingServiceTest.java

示例9: testReturnsExpectedDelaySupplier

import org.junit.jupiter.api.Assumptions; //导入方法依赖的package包/类
@ParameterizedTest
@DisplayName("it returns a delay supplier that returns the expected duration supplier")
@ArgumentsSource(ValidFixedArgumentsProvider.class)
void testReturnsExpectedDelaySupplier(Duration duration,
                                      List<Duration> expectedSuppliedDurations) {
    Assumptions.assumeTrue(null != expectedSuppliedDurations && !expectedSuppliedDurations.isEmpty(),
                           "Should have received a non-null and non-empty list of expected durations.");
    Supplier<Duration> supplier = DelaySuppliers.fixed(duration).create();
    Assertions.assertAll(expectedSuppliedDurations.stream().map(next -> () -> Assertions.assertEquals(next, supplier.get())));
}
 
开发者ID:redfin,项目名称:patience,代码行数:11,代码来源:DelaySuppliersTest.java

示例10: testReturnsExpectedSupplier

import org.junit.jupiter.api.Assumptions; //导入方法依赖的package包/类
@ParameterizedTest
@DisplayName("it returns the expected type of Supplier")
@ArgumentsSource(ExpectedDurations.class)
void testReturnsExpectedSupplier(int base,
                                 Duration duration,
                                 List<Duration> expectedDurations) {
    Assumptions.assumeTrue(null != expectedDurations && !expectedDurations.isEmpty(),
                           "Should be given at least 1 expected result duration.");
    Supplier<Duration> supplier = getInstance(base, duration).create();
    Assertions.assertAll(expectedDurations.stream()
                                          .map(d -> (Executable) () -> Assertions.assertEquals(d,
                                                                                               supplier.get(),
                                                                                               "Duration supplier should return the expected durations."))
                                          .toArray(Executable[]::new));
}
 
开发者ID:redfin,项目名称:patience,代码行数:16,代码来源:ExponentialDelaySupplierFactoryTest.java

示例11: assumeIsPresent

import org.junit.jupiter.api.Assumptions; //导入方法依赖的package包/类
static void assumeIsPresent(String variable) {
	Assumptions.assumeTrue(EnvironmentHelper.isPresent(variable));
}
 
开发者ID:CMSgov,项目名称:qpp-conversion-tool,代码行数:4,代码来源:VariableDependantTestHelper.java


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