2016-04-15 23:47:32 +03:00
|
|
|
package com.baeldung;
|
|
|
|
|
2016-11-14 09:45:01 +01:00
|
|
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
|
|
|
import static org.junit.jupiter.api.Assumptions.assumeFalse;
|
|
|
|
import static org.junit.jupiter.api.Assumptions.assumeTrue;
|
|
|
|
import static org.junit.jupiter.api.Assumptions.assumingThat;
|
2016-04-15 23:47:32 +03:00
|
|
|
|
2016-11-14 09:45:01 +01:00
|
|
|
import org.junit.jupiter.api.Test;
|
2016-04-15 23:47:32 +03:00
|
|
|
|
|
|
|
public class AssumptionTest {
|
|
|
|
|
|
|
|
@Test
|
|
|
|
void trueAssumption() {
|
|
|
|
assumeTrue(5 > 1);
|
2016-05-02 13:00:21 +03:00
|
|
|
assertEquals(5 + 2, 7);
|
2016-04-15 23:47:32 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
@Test
|
|
|
|
void falseAssumption() {
|
|
|
|
assumeFalse(5 < 1);
|
2016-05-02 13:00:21 +03:00
|
|
|
assertEquals(5 + 2, 7);
|
2016-04-15 23:47:32 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
@Test
|
|
|
|
void assumptionThat() {
|
|
|
|
String someString = "Just a string";
|
|
|
|
assumingThat(
|
|
|
|
someString.equals("Just a string"),
|
2016-05-02 13:00:21 +03:00
|
|
|
() -> assertEquals(2 + 2, 4)
|
2016-04-15 23:47:32 +03:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|