Skip to content

Commit

Permalink
feat: Create GET About Page test (#159)
Browse files Browse the repository at this point in the history
Fix PMD warnings
  • Loading branch information
nverbic authored Dec 9, 2024
1 parent 06a87ea commit 4555a60
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
package com.wcc.platform.integrationtests;

import static com.wcc.platform.domain.cms.PageType.ABOUT_US;
import static com.wcc.platform.domain.cms.PageType.CODE_OF_CONDUCT;
import static com.wcc.platform.domain.cms.PageType.COLLABORATOR;
import static com.wcc.platform.domain.cms.PageType.FOOTER;
import static com.wcc.platform.domain.cms.PageType.TEAM;
import static com.wcc.platform.factories.SetupFactories.OBJECT_MAPPER;
import static com.wcc.platform.factories.SetupFactories.createAboutUsPageTest;
import static com.wcc.platform.factories.SetupFactories.createCodeOfConductPageTest;
import static com.wcc.platform.factories.SetupFactories.createCollaboratorPageTest;
import static com.wcc.platform.factories.SetupFactories.createFooterPageTest;
Expand Down Expand Up @@ -96,4 +98,14 @@ void testGetLandingPageFallback() {

JSONAssert.assertEquals(expected, jsonResponse, false);
}

@Test
void testGetAboutUsPage() {
var result = service.getAboutUs();
var expectedAboutUsPage = createAboutUsPageTest(ABOUT_US.getFileName());

assertEquals(expectedAboutUsPage.heroSection(), result.heroSection());
assertEquals(expectedAboutUsPage.items(), result.items());
assertEquals(expectedAboutUsPage.contact(), result.contact());
}
}
4 changes: 2 additions & 2 deletions src/test/java/com/wcc/platform/service/CmsServiceTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ void whenGetLandingPageGivenValidJsonThenReturnPage() throws IOException {
}

@Test
void getAboutUsPageGivenInvalidJson() throws IOException {
void whenGetAboutUsPageGivenInvalidJson() throws IOException {
when(objectMapper.readValue(anyString(), eq(AboutUsPage.class)))
.thenThrow(new JsonProcessingException("Invalid JSON") {});

Expand All @@ -154,7 +154,7 @@ void getAboutUsPageGivenInvalidJson() throws IOException {
}

@Test
void getAboutUsPageGivenValidJson() throws IOException {
void whenGetAboutUsPageGivenValidJson() throws IOException {
var aboutUsPage = SetupFactories.createAboutUsPageTest();
when(objectMapper.readValue(anyString(), eq(AboutUsPage.class))).thenReturn(aboutUsPage);

Expand Down

0 comments on commit 4555a60

Please sign in to comment.