From be7064335f8a85997841608f48019474222d5753 Mon Sep 17 00:00:00 2001 From: Basmalamoustafa <75669135+Basmalamoustafa@users.noreply.github.com> Date: Tue, 14 Jan 2025 20:31:32 +0200 Subject: [PATCH] Create TemplateViewRobotTest.java #606 robot pattern issue test --- .../templateview/TemplateViewRobotTest.java | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 templateview/src/test/java/com/iluwatar/templateview/TemplateViewRobotTest.java diff --git a/templateview/src/test/java/com/iluwatar/templateview/TemplateViewRobotTest.java b/templateview/src/test/java/com/iluwatar/templateview/TemplateViewRobotTest.java new file mode 100644 index 000000000000..97f5fa4cc4d0 --- /dev/null +++ b/templateview/src/test/java/com/iluwatar/templateview/TemplateViewRobotTest.java @@ -0,0 +1,48 @@ +package com.iluwatar.templateview; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + + +class TemplateViewRobotTest { + + private TemplateViewRobot robot; + + @BeforeEach + void setUp() { + robot = new TemplateViewRobot(); + } + + @Test + void shouldRenderHomePageCorrectly() { + + TemplateView homePage = new HomePageView(); + + robot.render(homePage) + .verifyContent("Rendering header...") + .verifyContent("Rendering HomePage dynamic content...") + .verifyContent("Rendering footer..."); + } + + @Test + void shouldRenderContactPageCorrectly() { + + TemplateView contactPage = new ContactPageView(); + + robot.render(contactPage) + .verifyContent("Rendering header...") + .verifyContent("Rendering ContactPage dynamic content...") + .verifyContent("Rendering footer..."); + } + + @Test + void shouldResetCapturedOutput() { + TemplateView homePage = new HomePageView(); + + robot.render(homePage) + .verifyContent("Rendering HomePage dynamic content...") + .reset() + .render(new ContactPageView()) + .verifyContent("Rendering ContactPage dynamic content..."); + } +}