-
Notifications
You must be signed in to change notification settings - Fork 673
Expand file tree
/
Copy pathIndexControllerTest.java
More file actions
40 lines (32 loc) · 1.11 KB
/
IndexControllerTest.java
File metadata and controls
40 lines (32 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package guru.springframework.sfgpetclinic.controllers;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
/*
Author: jalnor
Date: 7/12/2021 5:08 AM
Project: guru.springframework.sfgpetclinic.controllers
*/
class IndexControllerTest {
IndexController indexController;
@BeforeEach
void setUp() {
indexController = new IndexController();
}
@DisplayName("Test proper view name is returned for the index page")
@Test
void index() {
assertEquals("index", indexController.index());
assertEquals("index", indexController.index(), "Wrong view returned");
assertEquals("index", indexController.index(), () -> "Another expensive message, " +
"make only if necessary!!!!!");
}
@Test
@DisplayName("Test exception")
void oupsHandler() {
assertTrue("notimplemented".equals(indexController.oupsHandler()), () -> "This is some expensive " +
"message to build " +
"for my test");
}
}