diff --git a/src/main/java/org/commcare/formplayer/db/migration/V11__form_session_add_missing_appid.java b/src/main/java/org/commcare/formplayer/db/migration/V11__form_session_add_missing_appid.java index bcfc3a13f..cb25766d2 100644 --- a/src/main/java/org/commcare/formplayer/db/migration/V11__form_session_add_missing_appid.java +++ b/src/main/java/org/commcare/formplayer/db/migration/V11__form_session_add_missing_appid.java @@ -49,7 +49,7 @@ private void updateObject(ToBeFixed fixObject, JdbcTemplate jdbcTemplate) { if (menuSessionId != null && !"".equals(menuSessionId)) { String query = "SELECT appid FROM menu_sessions WHERE id = ?"; - String menuAppId = jdbcTemplate.queryForObject(query, new Object[] { menuSessionId }, String.class); + String menuAppId = jdbcTemplate.queryForObject(query, String.class, menuSessionId); if (menuAppId != null && !"".equals(menuAppId)) { executeUpdate(jdbcTemplate, menuAppId, sessionId); return; diff --git a/src/test/java/org/commcare/formplayer/repo/FormSessionRepoTest.java b/src/test/java/org/commcare/formplayer/repo/FormSessionRepoTest.java index cd5be9aed..068d94ebf 100644 --- a/src/test/java/org/commcare/formplayer/repo/FormSessionRepoTest.java +++ b/src/test/java/org/commcare/formplayer/repo/FormSessionRepoTest.java @@ -56,7 +56,7 @@ public void testSaveAndLoad() { formSessionRepo.saveAndFlush(session); entityManager.clear(); // clear the EM cache to force a re-fetch from DB SerializableFormSession loaded = JpaTestUtils.unwrapProxy( - formSessionRepo.getOne(session.getId()) + formSessionRepo.getById(session.getId()) ); assertThat(loaded).usingRecursiveComparison().ignoringFields("dateCreated", "version").isEqualTo(session); Instant dateCreated = loaded.getDateCreated(); diff --git a/src/test/java/org/commcare/formplayer/repo/MenuSessionRepoTest.java b/src/test/java/org/commcare/formplayer/repo/MenuSessionRepoTest.java index f52a90646..a6faf3831 100644 --- a/src/test/java/org/commcare/formplayer/repo/MenuSessionRepoTest.java +++ b/src/test/java/org/commcare/formplayer/repo/MenuSessionRepoTest.java @@ -49,7 +49,7 @@ public void testSaveAndLoad() { menuSessionRepo.saveAndFlush(session); entityManager.clear(); // clear the EM cache to force a re-fetch from DB SerializableMenuSession loaded = JpaTestUtils.unwrapProxy( - menuSessionRepo.getOne(session.getId()) + menuSessionRepo.getById(session.getId()) ); assertThat(loaded).usingRecursiveComparison().isEqualTo(session); } diff --git a/src/test/java/org/commcare/formplayer/tests/BaseTestClass.java b/src/test/java/org/commcare/formplayer/tests/BaseTestClass.java index 4dfb2a180..400f26cd9 100644 --- a/src/test/java/org/commcare/formplayer/tests/BaseTestClass.java +++ b/src/test/java/org/commcare/formplayer/tests/BaseTestClass.java @@ -185,7 +185,7 @@ public void setUp() throws Exception { Mockito.reset(datadogMock); Mockito.reset(menuSessionFactory); Mockito.reset(menuSessionRunnerService); - MockitoAnnotations.initMocks(this); + MockitoAnnotations.openMocks(this); mockFormController = MockMvcBuilders.standaloneSetup(formController).build(); mockFormSubmissionController = MockMvcBuilders.standaloneSetup(formSubmissionController).build(); mockUtilController = MockMvcBuilders.standaloneSetup(utilController).build(); diff --git a/src/test/java/org/commcare/formplayer/tests/CaseClaimTests.java b/src/test/java/org/commcare/formplayer/tests/CaseClaimTests.java index e6fe5ae2b..b142bf51b 100644 --- a/src/test/java/org/commcare/formplayer/tests/CaseClaimTests.java +++ b/src/test/java/org/commcare/formplayer/tests/CaseClaimTests.java @@ -24,9 +24,9 @@ import java.util.List; import static org.junit.jupiter.api.Assertions.assertArrayEquals; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.anyBoolean; -import static org.mockito.Matchers.anyString; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyBoolean; +import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; diff --git a/src/test/java/org/commcare/formplayer/tests/GroupTests.java b/src/test/java/org/commcare/formplayer/tests/GroupTests.java index c46d565ec..15e067966 100644 --- a/src/test/java/org/commcare/formplayer/tests/GroupTests.java +++ b/src/test/java/org/commcare/formplayer/tests/GroupTests.java @@ -11,7 +11,7 @@ import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; import org.commcare.formplayer.utils.TestContext; -import static org.mockito.Matchers.any; +import static org.mockito.ArgumentMatchers.any; /** * Fills out the "Basic Tests > Groups" Form from the QA plan. @@ -115,4 +115,4 @@ public void testMultiSelectGroups() throws Exception { public void testInnerOuterGroups() throws Exception { NewFormResponse newSessionResponse = startNewForm("requests/new_form/new_form_group.json", "xforms/groups.xml"); } -} \ No newline at end of file +} diff --git a/src/test/java/org/commcare/formplayer/tests/NewFormTests.java b/src/test/java/org/commcare/formplayer/tests/NewFormTests.java index 51c2fb9bd..6253a8d52 100644 --- a/src/test/java/org/commcare/formplayer/tests/NewFormTests.java +++ b/src/test/java/org/commcare/formplayer/tests/NewFormTests.java @@ -7,7 +7,7 @@ import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest; import org.commcare.formplayer.utils.TestContext; -import static org.mockito.Matchers.any; +import static org.mockito.ArgumentMatchers.any; /** * Created by willpride on 1/14/16. @@ -63,4 +63,4 @@ protected String getMockRestoreFileName() { public void editFormWithUserData() throws Exception { startNewForm("requests/new_form/edit_user_data.json", "xforms/edit_user_data.xml"); } -} \ No newline at end of file +} diff --git a/src/test/java/org/commcare/formplayer/tests/RestoreFactoryTest.java b/src/test/java/org/commcare/formplayer/tests/RestoreFactoryTest.java index 8c7b22c68..c5b7c3909 100644 --- a/src/test/java/org/commcare/formplayer/tests/RestoreFactoryTest.java +++ b/src/test/java/org/commcare/formplayer/tests/RestoreFactoryTest.java @@ -47,7 +47,7 @@ public class RestoreFactoryTest { @BeforeEach public void setUp() throws Exception { Mockito.reset(restoreFactorySpy); - MockitoAnnotations.initMocks(this); + MockitoAnnotations.openMocks(this); AuthenticatedRequestBean requestBean = new AuthenticatedRequestBean(); requestBean.setRestoreAs(asUsername); requestBean.setUsername(username); diff --git a/src/test/java/org/commcare/formplayer/utils/TestContext.java b/src/test/java/org/commcare/formplayer/utils/TestContext.java index 9765b4df5..12cc97241 100644 --- a/src/test/java/org/commcare/formplayer/utils/TestContext.java +++ b/src/test/java/org/commcare/formplayer/utils/TestContext.java @@ -36,7 +36,7 @@ public class TestContext { public TestContext() { - MockitoAnnotations.initMocks(this); + MockitoAnnotations.openMocks(this); } @Bean