add modules for spring boot custom starter BAEL-762 (#1661)
This commit is contained in:
committed by
Grzegorz Piwowarek
parent
709857b9aa
commit
54d24521af
+50
@@ -0,0 +1,50 @@
|
||||
package com.baeldung.greeter.sample;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
import com.baeldung.greeter.Greeter;
|
||||
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@SpringBootTest(classes = GreeterSampleApplication.class)
|
||||
public class GreeterSampleApplicationTest {
|
||||
|
||||
@Autowired
|
||||
private Greeter greeter;
|
||||
|
||||
@Test
|
||||
public void givenMorningTime_ifMorningMessage_thenSuccess() {
|
||||
String expected = "Hello Baeldung, Good Morning";
|
||||
String actual = greeter.greet(LocalDateTime.of(2017, 3, 1, 6, 0));
|
||||
assertEquals(expected, actual);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenAfternoonTime_ifAfternoonMessage_thenSuccess() {
|
||||
String expected = "Hello Baeldung, Woha Afternoon";
|
||||
String actual = greeter.greet(LocalDateTime.of(2017, 3, 1, 13, 0));
|
||||
assertEquals(expected, actual);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenEveningTime_ifEveningMessage_thenSuccess() {
|
||||
String expected = "Hello Baeldung, Good Evening";
|
||||
String actual = greeter.greet(LocalDateTime.of(2017, 3, 1, 19, 0));
|
||||
assertEquals(expected, actual);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenNightTime_ifNightMessage_thenSuccess() {
|
||||
String expected = "Hello Baeldung, Good Night";
|
||||
String actual = greeter.greet(LocalDateTime.of(2017, 3, 1, 21, 0));
|
||||
assertEquals(expected, actual);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user