Skip to content

Commit be70643

Browse files
Create TemplateViewRobotTest.java
iluwatar#606 robot pattern issue test
1 parent 3a1a714 commit be70643

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
package com.iluwatar.templateview;
2+
3+
import org.junit.jupiter.api.BeforeEach;
4+
import org.junit.jupiter.api.Test;
5+
6+
7+
class TemplateViewRobotTest {
8+
9+
private TemplateViewRobot robot;
10+
11+
@BeforeEach
12+
void setUp() {
13+
robot = new TemplateViewRobot();
14+
}
15+
16+
@Test
17+
void shouldRenderHomePageCorrectly() {
18+
19+
TemplateView homePage = new HomePageView();
20+
21+
robot.render(homePage)
22+
.verifyContent("Rendering header...")
23+
.verifyContent("Rendering HomePage dynamic content...")
24+
.verifyContent("Rendering footer...");
25+
}
26+
27+
@Test
28+
void shouldRenderContactPageCorrectly() {
29+
30+
TemplateView contactPage = new ContactPageView();
31+
32+
robot.render(contactPage)
33+
.verifyContent("Rendering header...")
34+
.verifyContent("Rendering ContactPage dynamic content...")
35+
.verifyContent("Rendering footer...");
36+
}
37+
38+
@Test
39+
void shouldResetCapturedOutput() {
40+
TemplateView homePage = new HomePageView();
41+
42+
robot.render(homePage)
43+
.verifyContent("Rendering HomePage dynamic content...")
44+
.reset()
45+
.render(new ContactPageView())
46+
.verifyContent("Rendering ContactPage dynamic content...");
47+
}
48+
}

0 commit comments

Comments
 (0)