Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,54 @@
<java.version>11</java.version>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
<junit-platform-version>5.3.1</junit-platform-version>
</properties>

<dependencies>
<dependency>
<!-- for test annotations-->
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>${junit-platform-version}</version>
<scope>test</scope>
</dependency>
<dependency>
<!-- for the engine-->
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${junit-platform-version}</version>
<scope>test</scope>
</dependency>
</dependencies>

<!-- build plugins-->
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.0</version>
<configuration>
<argLine>
--illegal-access=permit
</argLine>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.22.0</version>
<configuration>
<argLine>
--illegal-access=permit
</argLine>
</configuration>
</plugin>
</plugins>
</build>
</project>
44 changes: 44 additions & 0 deletions src/test/java/guru/springframework/GreatingTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package guru.springframework;

import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.*;

class GreatingTest {

private Greating greeting;
@BeforeAll
public static void beforeClass(){
System.out.println("before class");
}

@BeforeEach
void setUp() {
System.out.println("before each");
greeting=new Greating();
}

@Test
void helloWorld() {
System.out.println("test 1");
}

@Test
void testHelloWorld() {
System.out.println("test 2");
}

@AfterEach
void tearDown() {
System.out.println("after each");
}

@BeforeAll
public static void beforeClass(){
System.out.println("before class");
}

}