This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<properties> | |
<assertj.version>3.8.0</assertj.version> | |
</properties> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* brandsの中で、nameに「e」を含んでいるものを抽出 | |
*/ | |
@Test | |
public void filteringPredicate() { | |
Brand stof = new Brand("stof", "Tanita", Gender.MAN); | |
Brand bedsidedrama = new Brand("bedsidedrama", "Tanita", Gender.MAN); | |
Brand sneeuw = new Brand("sneeuw", "Yukiura", Gender.WOMAN); | |
Brand ethosens = new Brand("ETHOSENS", "Hashimoto", Gender.MAN); | |
Brand dulcamara = new Brand("Dulcamara", "Yoda", Gender.WOMAN); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.example.assertjsandbox.model; | |
import lombok.AllArgsConstructor; | |
import lombok.Getter; | |
import lombok.NoArgsConstructor; | |
import lombok.Setter; | |
@Getter | |
@Setter | |
@NoArgsConstructor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<dependencies> | |
<dependency> | |
<groupId>org.junit.platform</groupId> | |
<artifactId>junit-platform-launcher</artifactId> | |
<version>1.0.2</version> | |
<scope>test</scope> | |
</dependency> | |
<dependency> | |
<groupId>org.junit.jupiter</groupId> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
executed before all test just once. | |
executed before each test. | |
This is test1. | |
This is Disabled test. | |
executed before each test. | |
This is test3. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
org.opentest4j.MultipleFailuresError: This is name test. (1 failure) | |
expected: <Ryo> but was: <Ryosuke> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
org.opentest4j.TestAbortedException: Assumption failed: This is invalid. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.junit.jupiter.api.*; | |
@DisplayName("This is standard test.") | |
class StandardTest { | |
@BeforeAll | |
static void beforeAll() { | |
System.out.println("executed before all test just once."); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.example.core.model.*; | |
import org.junit.jupiter.api.*; | |
import static org.junit.jupiter.api.Assertions.*; | |
import static org.junit.jupiter.api.Assumptions.*; | |
class StandardAssertionTest { | |
@Nested | |
class DependentAssertions { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.junit.jupiter.api.*; | |
import static org.junit.jupiter.api.Assertions.*; | |
class RepeatedTestDemo { | |
@BeforeEach | |
void beforeEach(TestInfo testInfo, RepetitionInfo repetitionInfo) { | |
// 現在の回数 | |
int currentRepetition = repetitionInfo.getCurrentRepetition(); |
OlderNewer