diff --git a/build.gradle b/build.gradle index e38b84c..2d6e1a2 100644 --- a/build.gradle +++ b/build.gradle @@ -7,8 +7,8 @@ plugins { id 'java-library' id 'maven-publish' id 'checkstyle' - id 'com.github.spotbugs' version '6.1.0' - id 'com.github.ben-manes.versions' version '0.51.0' + id 'com.github.spotbugs' version '6.1.2' + id 'com.github.ben-manes.versions' version '0.52.0' } ext { diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index cea7a79..e18bc25 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.12.1-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/src/test/java/org/jivesoftware/openfire/plugin/passwordreset/Fixtures.java b/src/test/java/org/jivesoftware/openfire/plugin/passwordreset/Fixtures.java index 0454f8f..4bdecf1 100644 --- a/src/test/java/org/jivesoftware/openfire/plugin/passwordreset/Fixtures.java +++ b/src/test/java/org/jivesoftware/openfire/plugin/passwordreset/Fixtures.java @@ -9,6 +9,7 @@ import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import java.io.File; import java.net.URL; +import lombok.SneakyThrows; import org.jivesoftware.openfire.IQRouter; import org.jivesoftware.openfire.XMPPServer; import org.jivesoftware.openfire.XMPPServerInfo; @@ -32,7 +33,8 @@ private Fixtures() { * JiveGlobals#setProperty(String, String)} etc. to work (and persist) in test classes without * errors being displayed to stderr. Ideally should be called in a {@link BeforeAll} method. */ - public static void reconfigureOpenfireHome() throws Exception { + @SneakyThrows + public static void reconfigureOpenfireHome() { final URL configFile = ClassLoader.getSystemResource("conf/openfire.xml"); if (configFile == null) { throw new IllegalStateException( diff --git a/src/test/java/org/jivesoftware/openfire/plugin/passwordreset/PasswordResetMailerTest.java b/src/test/java/org/jivesoftware/openfire/plugin/passwordreset/PasswordResetMailerTest.java index 30f6021..45652ae 100644 --- a/src/test/java/org/jivesoftware/openfire/plugin/passwordreset/PasswordResetMailerTest.java +++ b/src/test/java/org/jivesoftware/openfire/plugin/passwordreset/PasswordResetMailerTest.java @@ -27,7 +27,7 @@ class PasswordResetMailerTest { @BeforeAll @SuppressWarnings("deprecation") - static void beforeAll() throws Exception { + static void beforeAll() { Fixtures.reconfigureOpenfireHome(); XMPPServer.setInstance(Fixtures.mockXmppServer()); } diff --git a/src/test/java/org/jivesoftware/openfire/plugin/passwordreset/PasswordResetTokenManagerTest.java b/src/test/java/org/jivesoftware/openfire/plugin/passwordreset/PasswordResetTokenManagerTest.java index 4d7ffd9..8eb24fa 100644 --- a/src/test/java/org/jivesoftware/openfire/plugin/passwordreset/PasswordResetTokenManagerTest.java +++ b/src/test/java/org/jivesoftware/openfire/plugin/passwordreset/PasswordResetTokenManagerTest.java @@ -10,6 +10,7 @@ import java.sql.Connection; import java.sql.PreparedStatement; import java.util.Date; +import lombok.SneakyThrows; import org.jivesoftware.openfire.XMPPServer; import org.jivesoftware.openfire.user.User; import org.junit.jupiter.api.BeforeAll; @@ -31,7 +32,7 @@ class PasswordResetTokenManagerTest { @BeforeAll @SuppressWarnings("deprecation") - static void beforeAll() throws Exception { + static void beforeAll() { Fixtures.reconfigureOpenfireHome(); XMPPServer.setInstance(Fixtures.mockXmppServer()); } @@ -45,7 +46,8 @@ static void beforeAll() throws Exception { "ODR_OPEN_DATABASE_RESOURCE", "RV_RETURN_VALUE_IGNORED"}, justification = "All false positives!") - void setUp() throws Exception { + @SneakyThrows + void setUp() { Fixtures.reconfigureOpenfireHome(); user = new User("test-username", "Test User", "test@example.com", new Date(), new Date()); @@ -61,7 +63,8 @@ void setUp() throws Exception { @SuppressFBWarnings( value = {"UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR"}, justification = "False positive") - void willGenerateRandomTokenForUser() throws Exception { + @SneakyThrows + void willGenerateRandomTokenForUser() { final String token1 = resetTokenManager.generateToken(user, "localhost"); final String token2 = resetTokenManager.generateToken(user, "localhost"); diff --git a/src/test/java/org/jivesoftware/openfire/plugin/passwordreset/servlet/admin/PasswordResetSettingsServletTest.java b/src/test/java/org/jivesoftware/openfire/plugin/passwordreset/servlet/admin/PasswordResetSettingsServletTest.java index 41a5b6c..e8f1f97 100644 --- a/src/test/java/org/jivesoftware/openfire/plugin/passwordreset/servlet/admin/PasswordResetSettingsServletTest.java +++ b/src/test/java/org/jivesoftware/openfire/plugin/passwordreset/servlet/admin/PasswordResetSettingsServletTest.java @@ -14,6 +14,7 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; +import lombok.SneakyThrows; import org.jivesoftware.admin.FlashMessageTag; import org.jivesoftware.openfire.XMPPServer; import org.jivesoftware.openfire.plugin.passwordreset.Fixtures; @@ -57,7 +58,7 @@ class PasswordResetSettingsServletTest { @BeforeAll @SuppressWarnings("deprecation") - static void beforeAll() throws Exception { + static void beforeAll() { Fixtures.reconfigureOpenfireHome(); XMPPServer.setInstance(Fixtures.mockXmppServer()); } @@ -71,8 +72,9 @@ void setUp() { userProvider, () -> webManager, passwordResetMailer, tokenManager); } + @SneakyThrows @Test - void willForwardToJsp() throws Exception { + void willForwardToJsp() { final HttpServletRequest request = blankRequest(); @@ -82,8 +84,9 @@ void willForwardToJsp() throws Exception { } + @SneakyThrows @Test - void willSetValidForm() throws Exception { + void willSetValidForm() { final HttpServletRequest request = blankRequest(); @@ -122,7 +125,7 @@ private HttpServletRequest requestWithValidFormSubmitted() { doReturn("true") .when(request) .getParameter("enabled"); - doReturn("http://example.com:7443/passwordreset") + doReturn("https://example.com:7443/passwordreset") .when(request) .getParameter("server"); doReturn("Openfire") @@ -152,8 +155,9 @@ private HttpServletRequest requestWithValidFormSubmitted() { return request; } + @SneakyThrows @Test - void willValidateThatTheServerIsPresent() throws Exception { + void willValidateThatTheServerIsPresent() { final HttpServletRequest request = requestWithValidFormSubmitted(); doReturn("").when(request).getParameter("server"); @@ -167,8 +171,9 @@ void willValidateThatTheServerIsPresent() throws Exception { .isEqualTo("???passwordreset.settings.no-server???"); } + @SneakyThrows @Test - void willValidateThatTheServerIsNotTooLong() throws Exception { + void willValidateThatTheServerIsNotTooLong() { final HttpServletRequest request = requestWithValidFormSubmitted(); doReturn(new String(new char[4001]).replace('\0', 'X')) @@ -184,8 +189,9 @@ void willValidateThatTheServerIsNotTooLong() throws Exception { .isEqualTo("???passwordreset.settings.server-too-long???"); } + @SneakyThrows @Test - void willCheckTheServerIsAnHttpServer() throws Exception { + void willCheckTheServerIsAnHttpServer() { final HttpServletRequest request = requestWithValidFormSubmitted(); doReturn("ftp://example.com") @@ -201,8 +207,9 @@ void willCheckTheServerIsAnHttpServer() throws Exception { .isEqualTo("???passwordreset.settings.server-no-http???"); } + @SneakyThrows @Test - void willCheckTheSenderNameIsPresent() throws Exception { + void willCheckTheSenderNameIsPresent() { final HttpServletRequest request = requestWithValidFormSubmitted(); doReturn("") .when(request) @@ -217,8 +224,9 @@ void willCheckTheSenderNameIsPresent() throws Exception { .isEqualTo("???passwordreset.settings.no-sender-name???"); } + @SneakyThrows @Test - void willValidateThatTheSenderNameIsNotTooLong() throws Exception { + void willValidateThatTheSenderNameIsNotTooLong() { final HttpServletRequest request = requestWithValidFormSubmitted(); doReturn(new String(new char[4001]).replace('\0', 'X')) @@ -234,8 +242,9 @@ void willValidateThatTheSenderNameIsNotTooLong() throws Exception { .isEqualTo("???passwordreset.settings.sender-name-too-long???"); } + @SneakyThrows @Test - void willCheckTheSenderAddressIsPresent() throws Exception { + void willCheckTheSenderAddressIsPresent() { final HttpServletRequest request = requestWithValidFormSubmitted(); doReturn("") .when(request) @@ -250,8 +259,9 @@ void willCheckTheSenderAddressIsPresent() throws Exception { .isEqualTo("???passwordreset.settings.no-sender-address???"); } + @SneakyThrows @Test - void willValidateThatTheSenderAddressIsNotTooLong() throws Exception { + void willValidateThatTheSenderAddressIsNotTooLong() { final HttpServletRequest request = requestWithValidFormSubmitted(); doReturn(new String(new char[4001]).replace('\0', 'X')) @@ -267,8 +277,9 @@ void willValidateThatTheSenderAddressIsNotTooLong() throws Exception { .isEqualTo("???passwordreset.settings.sender-address-too-long???"); } + @SneakyThrows @Test - void willValidateThatTheSenderAddressIsAnAddress() throws Exception { + void willValidateThatTheSenderAddressIsAnAddress() { final HttpServletRequest request = requestWithValidFormSubmitted(); doReturn("this is not an email address") @@ -284,8 +295,9 @@ void willValidateThatTheSenderAddressIsAnAddress() throws Exception { .isEqualTo("???passwordreset.settings.sender-address-invalid???"); } + @SneakyThrows @Test - void willValidateThatTheSubjectIsPresent() throws Exception { + void willValidateThatTheSubjectIsPresent() { final HttpServletRequest request = requestWithValidFormSubmitted(); doReturn("").when(request).getParameter("subject"); @@ -299,8 +311,9 @@ void willValidateThatTheSubjectIsPresent() throws Exception { .isEqualTo("???passwordreset.settings.no-subject???"); } + @SneakyThrows @Test - void willValidateThatTheSubjectIsNotTooLong() throws Exception { + void willValidateThatTheSubjectIsNotTooLong() { final HttpServletRequest request = requestWithValidFormSubmitted(); doReturn(new String(new char[4001]).replace('\0', 'X')) @@ -316,8 +329,9 @@ void willValidateThatTheSubjectIsNotTooLong() throws Exception { .isEqualTo("???passwordreset.settings.subject-too-long???"); } + @SneakyThrows @Test - void willValidateThatTheBodyIsPresent() throws Exception { + void willValidateThatTheBodyIsPresent() { final HttpServletRequest request = requestWithValidFormSubmitted(); doReturn("").when(request).getParameter("body"); @@ -331,8 +345,9 @@ void willValidateThatTheBodyIsPresent() throws Exception { .isEqualTo("???passwordreset.settings.no-body???"); } + @SneakyThrows @Test - void willValidateThatTheBodyIsNotTooLong() throws Exception { + void willValidateThatTheBodyIsNotTooLong() { final HttpServletRequest request = requestWithValidFormSubmitted(); doReturn(new String(new char[4001]).replace('\0', 'X')) @@ -348,8 +363,9 @@ void willValidateThatTheBodyIsNotTooLong() throws Exception { .isEqualTo("???passwordreset.settings.body-too-long???"); } + @SneakyThrows @Test - void willValidateThatExpiryCountIsPresent() throws Exception { + void willValidateThatExpiryCountIsPresent() { final HttpServletRequest request = requestWithValidFormSubmitted(); doReturn("") @@ -365,8 +381,9 @@ void willValidateThatExpiryCountIsPresent() throws Exception { .isEqualTo("???passwordreset.settings.expiry-count-integer???"); } + @SneakyThrows @Test - void willValidateThatExpiryCountIsPositiveInteger() throws Exception { + void willValidateThatExpiryCountIsPositiveInteger() { final HttpServletRequest request = requestWithValidFormSubmitted(); doReturn("0") @@ -383,8 +400,9 @@ void willValidateThatExpiryCountIsPositiveInteger() throws Exception { } + @SneakyThrows @Test - void willValidateThatExpiryPeriodIsPresent() throws Exception { + void willValidateThatExpiryPeriodIsPresent() { final HttpServletRequest request = requestWithValidFormSubmitted(); doReturn("") @@ -400,8 +418,9 @@ void willValidateThatExpiryPeriodIsPresent() throws Exception { .isEqualTo("???passwordreset.settings.expiry-period-invalid???"); } + @SneakyThrows @Test - void willValidateThatExpiryPeriodIsValid() throws Exception { + void willValidateThatExpiryPeriodIsValid() { final HttpServletRequest request = requestWithValidFormSubmitted(); doReturn("not-a-period") @@ -417,8 +436,9 @@ void willValidateThatExpiryPeriodIsValid() throws Exception { .isEqualTo("???passwordreset.settings.expiry-period-invalid???"); } + @SneakyThrows @Test - void willValidateThatExpiryPeriodIsSupported() throws Exception { + void willValidateThatExpiryPeriodIsSupported() { final HttpServletRequest request = requestWithValidFormSubmitted(); doReturn("YEARS") @@ -434,8 +454,9 @@ void willValidateThatExpiryPeriodIsSupported() throws Exception { .isEqualTo("???passwordreset.settings.expiry-period-invalid???"); } + @SneakyThrows @Test - void willValidateThatMinLengthIsInteger() throws Exception { + void willValidateThatMinLengthIsInteger() { final HttpServletRequest request = requestWithValidFormSubmitted(); doReturn("") @@ -451,8 +472,9 @@ void willValidateThatMinLengthIsInteger() throws Exception { .isEqualTo("???passwordreset.settings.min-length-integer???"); } + @SneakyThrows @Test - void willValidateThatMaxLengthIsInteger() throws Exception { + void willValidateThatMaxLengthIsInteger() { final HttpServletRequest request = requestWithValidFormSubmitted(); doReturn("") @@ -468,8 +490,9 @@ void willValidateThatMaxLengthIsInteger() throws Exception { .isEqualTo("???passwordreset.settings.max-length-integer???"); } + @SneakyThrows @Test - void validateThatMaxLengthMustExceedMinLength() throws Exception { + void validateThatMaxLengthMustExceedMinLength() { final HttpServletRequest request = requestWithValidFormSubmitted(); doReturn("1") @@ -485,8 +508,9 @@ void validateThatMaxLengthMustExceedMinLength() throws Exception { .isEqualTo("???passwordreset.settings.max-length-too-short???"); } + @SneakyThrows @Test - void willRedirectWithValidFormDetails() throws Exception { + void willRedirectWithValidFormDetails() { final HttpServletRequest request = requestWithValidFormSubmitted(); @@ -495,8 +519,9 @@ void willRedirectWithValidFormDetails() throws Exception { verify(response).sendRedirect(REQUEST_URI); } + @SneakyThrows @Test - void willUpdateWithValidFormDetails() throws Exception { + void willUpdateWithValidFormDetails() { final HttpServletRequest request = requestWithValidFormSubmitted(); @@ -506,7 +531,7 @@ void willUpdateWithValidFormDetails() throws Exception { assertThat(PasswordResetPlugin.ENABLED.getValue()) .isEqualTo(true); assertThat(PasswordResetPlugin.SERVER.getValue()) - .isEqualTo("http://example.com:7443/passwordreset"); + .isEqualTo("https://example.com:7443/passwordreset"); assertThat(PasswordResetPlugin.SENDER_ADDRESS.getValue()) .isEqualTo("admin@example.org"); assertThat(PasswordResetPlugin.SUBJECT.getValue()) @@ -517,8 +542,9 @@ void willUpdateWithValidFormDetails() throws Exception { .isEqualTo(Duration.ofMinutes(42)); } + @SneakyThrows @Test - void postWillDoNothingWithReadOnlyProvider() throws Exception { + void postWillDoNothingWithReadOnlyProvider() { final HttpServletRequest request = requestWithValidFormSubmitted(); doReturn(true).when(userProvider).isReadOnly(); @@ -533,8 +559,9 @@ void postWillDoNothingWithReadOnlyProvider() throws Exception { .isEqualTo(""); } + @SneakyThrows @Test - void cancelWillDoNothing() throws Exception { + void cancelWillDoNothing() { final HttpServletRequest request = requestWithValidFormSubmitted(); doReturn("Cancel changes") @@ -551,8 +578,9 @@ void cancelWillDoNothing() throws Exception { .isEqualTo(""); } + @SneakyThrows @Test - void testWillSendTestEmail() throws Exception { + void testWillSendTestEmail() { final HttpServletRequest request = requestWithValidFormSubmitted(); doReturn(null) diff --git a/src/test/java/org/jivesoftware/openfire/plugin/passwordreset/servlet/client/PasswordResetChangePasswordServletTest.java b/src/test/java/org/jivesoftware/openfire/plugin/passwordreset/servlet/client/PasswordResetChangePasswordServletTest.java index d7c1321..3e00d67 100644 --- a/src/test/java/org/jivesoftware/openfire/plugin/passwordreset/servlet/client/PasswordResetChangePasswordServletTest.java +++ b/src/test/java/org/jivesoftware/openfire/plugin/passwordreset/servlet/client/PasswordResetChangePasswordServletTest.java @@ -17,6 +17,7 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; +import lombok.SneakyThrows; import org.jivesoftware.admin.FlashMessageTag; import org.jivesoftware.openfire.XMPPServer; import org.jivesoftware.openfire.plugin.passwordreset.Fixtures; @@ -55,7 +56,7 @@ class PasswordResetChangePasswordServletTest { @BeforeAll @SuppressWarnings("deprecation") - static void beforeAll() throws Exception { + static void beforeAll() { Fixtures.reconfigureOpenfireHome(); XMPPServer.setInstance(Fixtures.mockXmppServer()); } @@ -67,8 +68,9 @@ void setUp() { PasswordResetChangePasswordServlet.initStatic(tokenManager); } + @SneakyThrows @Test - void getWithValidTokenWillShowThePasswordChangeForm() throws Exception { + void getWithValidTokenWillShowThePasswordChangeForm() { doReturn(requestDispatcher) .when(request) @@ -87,8 +89,9 @@ void getWithValidTokenWillShowThePasswordChangeForm() throws Exception { verify(requestDispatcher).forward(request, response); } + @SneakyThrows @Test - void getWithBadTokenWillForwardToBadTokenPage() throws Exception { + void getWithBadTokenWillForwardToBadTokenPage() { doReturn(requestDispatcher) .when(request) @@ -103,8 +106,9 @@ void getWithBadTokenWillForwardToBadTokenPage() throws Exception { verify(requestDispatcher).forward(request, response); } + @SneakyThrows @Test - void getThatCausesSqlExceptionWillForwardToTheErrorPage() throws Exception { + void getThatCausesSqlExceptionWillForwardToTheErrorPage() { doReturn(requestDispatcher) .when(request) @@ -119,8 +123,9 @@ void getThatCausesSqlExceptionWillForwardToTheErrorPage() throws Exception { verify(requestDispatcher).forward(request, response); } + @SneakyThrows @Test - void postWithCancelWillRedirect() throws Exception { + void postWithCancelWillRedirect() { doReturn("Cancel") .when(request) @@ -138,8 +143,9 @@ void postWithCancelWillRedirect() throws Exception { verify(response).sendRedirect(REQUEST_URI); } + @SneakyThrows @Test - void postWithNothingWillRedirect() throws Exception { + void postWithNothingWillRedirect() { doReturn(REQUEST_URI) .when(request) @@ -154,11 +160,12 @@ void postWithNothingWillRedirect() throws Exception { verify(response).sendRedirect(REQUEST_URI); } + @SneakyThrows @Test @SuppressFBWarnings( value = "RV_RETURN_VALUE_IGNORED_NO_SIDE_EFFECT", justification = "False positive") - void validFormWillUpdatePasswordAndRedirect() throws Exception { + void validFormWillUpdatePasswordAndRedirect() { givenValidFormSubmission(); doReturn(session) @@ -205,8 +212,9 @@ private void givenValidFormSubmission() { .getRequestDispatcher("password-reset-change-password.jsp"); } + @SneakyThrows @Test - void newPasswordMustNotBeTooShort() throws Exception { + void newPasswordMustNotBeTooShort() { givenValidFormSubmission(); doReturn("short") @@ -220,7 +228,8 @@ void newPasswordMustNotBeTooShort() throws Exception { .isEqualTo("???passwordreset.change-password.new-password-too-short???"); } - Form verifyFormError() throws Exception { + @SneakyThrows + Form verifyFormError() { verify(user, never()).setPassword(anyString()); verify(tokenManager, never()).deleteTokens(any()); final ArgumentCaptor argumentCaptor @@ -232,8 +241,9 @@ Form verifyFormError() throws Exception { return form; } + @SneakyThrows @Test - void newPasswordMustNotBeTooLong() throws Exception { + void newPasswordMustNotBeTooLong() { givenValidFormSubmission(); PasswordResetPlugin.MAX_LENGTH.setValue(8); @@ -248,8 +258,9 @@ void newPasswordMustNotBeTooLong() throws Exception { .isEqualTo("???passwordreset.change-password.new-password-too-long???"); } + @SneakyThrows @Test - void passwordConfirmationMustMatch() throws Exception { + void passwordConfirmationMustMatch() { givenValidFormSubmission(); doReturn("newPasswordIsNotSameAsConfirmationPassword") @@ -263,8 +274,9 @@ void passwordConfirmationMustMatch() throws Exception { .isEqualTo("???passwordreset.change-password.password-confirmation-no-match???"); } + @SneakyThrows @Test - void badTokenWillRedirectToBadTokenPage() throws Exception { + void badTokenWillRedirectToBadTokenPage() { givenValidFormSubmission(); doReturn(Optional.empty()) @@ -284,11 +296,12 @@ void badTokenWillRedirectToBadTokenPage() throws Exception { } + @SneakyThrows @Test @SuppressFBWarnings( value = "RV_RETURN_VALUE_IGNORED_NO_SIDE_EFFECT", justification = "False positive") - void differentUserIdWillRedirectToBadTokenPage() throws Exception { + void differentUserIdWillRedirectToBadTokenPage() { givenValidFormSubmission(); doReturn(Optional.of(user)) diff --git a/src/test/java/org/jivesoftware/openfire/plugin/passwordreset/servlet/client/PasswordResetSendEmailServletTest.java b/src/test/java/org/jivesoftware/openfire/plugin/passwordreset/servlet/client/PasswordResetSendEmailServletTest.java index 852e4cd..e5b3924 100644 --- a/src/test/java/org/jivesoftware/openfire/plugin/passwordreset/servlet/client/PasswordResetSendEmailServletTest.java +++ b/src/test/java/org/jivesoftware/openfire/plugin/passwordreset/servlet/client/PasswordResetSendEmailServletTest.java @@ -13,6 +13,7 @@ import javax.servlet.RequestDispatcher; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import lombok.SneakyThrows; import org.jivesoftware.openfire.XMPPServer; import org.jivesoftware.openfire.plugin.passwordreset.Fixtures; import org.jivesoftware.openfire.plugin.passwordreset.PasswordResetMailer; @@ -55,7 +56,7 @@ class PasswordResetSendEmailServletTest { @BeforeAll @SuppressWarnings("deprecation") - static void beforeAll() throws Exception { + static void beforeAll() { Fixtures.reconfigureOpenfireHome(); XMPPServer.setInstance(Fixtures.mockXmppServer()); } @@ -81,8 +82,9 @@ void setUp() { passwordResetMailer); } + @SneakyThrows @Test - void getWillForwardWithBlankValidForm() throws Exception { + void getWillForwardWithBlankValidForm() { doReturn(requestDispatcher) .when(request) @@ -105,8 +107,9 @@ void getWillForwardWithBlankValidForm() throws Exception { .isEqualTo(""); } + @SneakyThrows @Test - void postWithBlankUserIdWillForwardWithInvalidForm() throws Exception { + void postWithBlankUserIdWillForwardWithInvalidForm() { doReturn(requestDispatcher) .when(request) @@ -129,8 +132,9 @@ void postWithBlankUserIdWillForwardWithInvalidForm() throws Exception { .isEqualTo("passwordreset.send-email.no-user"); } + @SneakyThrows @Test - void postWithValidUserIdWillGenerateTokenAndSendEmail() throws Exception { + void postWithValidUserIdWillGenerateTokenAndSendEmail() { doReturn(REMOTE_ADDRESS) .when(request) @@ -160,8 +164,9 @@ void postWithValidUserIdWillGenerateTokenAndSendEmail() throws Exception { .forward(request, response); } + @SneakyThrows @Test - void postWithValidJidWillGenerateTokenAndSendEmail() throws Exception { + void postWithValidJidWillGenerateTokenAndSendEmail() { doReturn(REMOTE_ADDRESS) .when(request) @@ -191,8 +196,9 @@ void postWithValidJidWillGenerateTokenAndSendEmail() throws Exception { .forward(request, response); } + @SneakyThrows @Test - void postWithValidEmailWillGenerateTokenAndSendEmail() throws Exception { + void postWithValidEmailWillGenerateTokenAndSendEmail() { doReturn(REMOTE_ADDRESS) .when(request) @@ -222,8 +228,9 @@ void postWithValidEmailWillGenerateTokenAndSendEmail() throws Exception { .forward(request, response); } + @SneakyThrows @Test - void willLookInTheSecondPageOfResults() throws Exception { + void willLookInTheSecondPageOfResults() { doReturn(REMOTE_ADDRESS) .when(request) @@ -254,8 +261,9 @@ void willLookInTheSecondPageOfResults() throws Exception { .forward(request, response); } + @SneakyThrows @Test - void willNotSendAnythingIfNoEmailMatches() throws Exception { + void willNotSendAnythingIfNoEmailMatches() { doReturn(requestDispatcher) .when(request)