Skip to content

Commit

Permalink
Move PdfMockMvcTest-specific setup out of Abstract superclass
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewedstrom committed Jun 29, 2021
1 parent a2a62bd commit 81bce8e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,12 @@ public class AbstractShibaMockMvcTest {
protected ApplicationData applicationData;

@Autowired
private MockMvc mockMvc;
protected MockMvc mockMvc;

private MockHttpSession session;
protected MockHttpSession session;

@BeforeEach
void setUp() throws Exception {
protected void setUp() throws Exception {
session = new MockHttpSession();

when(clock.instant()).thenReturn(Instant.now());
Expand All @@ -73,14 +73,6 @@ void setUp() throws Exception {
when(featureFlagConfiguration.get("submit-via-email")).thenReturn(FeatureFlag.OFF);
when(featureFlagConfiguration.get("submit-via-api")).thenReturn(FeatureFlag.OFF);
when(featureFlagConfiguration.get("county-anoka")).thenReturn(FeatureFlag.OFF);

mockMvc.perform(get("/pages/languagePreferences").session(session)); // start timer
postWithData("languagePreferences", Map.of(
"writtenLanguage", List.of("ENGLISH"),
"spokenLanguage", List.of("ENGLISH"))
);

postWithData("addHouseholdMembers", "addHouseholdMembers", "false");
}

@AfterEach
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,22 @@
import static org.codeforamerica.shiba.output.caf.CoverPageInputsMapper.CHILDCARE_WAITING_LIST_UTM_SOURCE;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.when;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;

@Tag("pdf")
public class PdfMockMvcTest extends AbstractShibaMockMvcTest {
@Override
@BeforeEach
protected void setUp() throws Exception {
super.setUp();
mockMvc.perform(get("/pages/languagePreferences").session(session)); // start timer
postWithData("languagePreferences", Map.of(
"writtenLanguage", List.of("ENGLISH"),
"spokenLanguage", List.of("ENGLISH"))
);

postWithData("addHouseholdMembers", "addHouseholdMembers", "false");
}

@Test
void shouldAnswerEnergyAssistanceQuestion() throws Exception {
Expand Down

0 comments on commit 81bce8e

Please sign in to comment.