diff --git a/src/main/java/org/takes/facets/auth/Token.java b/src/main/java/org/takes/facets/auth/Token.java index abc7c3e4f..52f430b93 100644 --- a/src/main/java/org/takes/facets/auth/Token.java +++ b/src/main/java/org/takes/facets/auth/Token.java @@ -52,9 +52,8 @@ public interface Token { * Base64 encoded JSON output. * * @return The Token in JSON notation, Base64-encoded. - * @throws IOException If encoding fails */ - byte[] encoded() throws IOException; + byte[] encoded(); /** * JSON Object Signing and Encryption Header. @@ -93,7 +92,7 @@ public JsonObject json() { } @Override - public byte[] encoded() throws IOException { + public byte[] encoded() { return Base64.getEncoder().encode( this.joseo.toString().getBytes(Charset.defaultCharset()) ); @@ -167,7 +166,7 @@ public JsonObject json() { } @Override - public byte[] encoded() throws IOException { + public byte[] encoded() { return Base64.getEncoder().encode( this.jwto.toString().getBytes(Charset.defaultCharset()) ); diff --git a/src/main/java/org/takes/facets/auth/codecs/CcCompact.java b/src/main/java/org/takes/facets/auth/codecs/CcCompact.java index 1fc34a99f..2398c5211 100644 --- a/src/main/java/org/takes/facets/auth/codecs/CcCompact.java +++ b/src/main/java/org/takes/facets/auth/codecs/CcCompact.java @@ -44,7 +44,7 @@ public final class CcCompact implements Codec { @Override - public byte[] encode(final Identity identity) throws IOException { + public byte[] encode(final Identity identity) { final ByteArrayOutputStream data = new ByteArrayOutputStream(); try (DataOutputStream stream = new DataOutputStream(data)) { stream.writeUTF(identity.urn()); @@ -60,7 +60,7 @@ public byte[] encode(final Identity identity) throws IOException { } @Override - public Identity decode(final byte[] bytes) throws IOException { + public Identity decode(final byte[] bytes) { final Map map = new HashMap<>(0); try (DataInputStream stream = new DataInputStream( new ByteArrayInputStream(bytes) diff --git a/src/main/java/org/takes/facets/fork/FkHitRefresh.java b/src/main/java/org/takes/facets/fork/FkHitRefresh.java index 8bc4963a4..3f66dcb74 100644 --- a/src/main/java/org/takes/facets/fork/FkHitRefresh.java +++ b/src/main/java/org/takes/facets/fork/FkHitRefresh.java @@ -215,9 +215,8 @@ public void touch() throws IOException { /** * Expired? * @return TRUE if expired - * @throws IOException If fails */ - private boolean expired() throws IOException { + private boolean expired() { final boolean expired; if (this.flag.isEmpty()) { expired = true; diff --git a/src/main/java/org/takes/rq/RqPrint.java b/src/main/java/org/takes/rq/RqPrint.java index dd56ded21..6e8b9cdc3 100644 --- a/src/main/java/org/takes/rq/RqPrint.java +++ b/src/main/java/org/takes/rq/RqPrint.java @@ -88,9 +88,8 @@ public String print() throws IOException { /** * Print it all. * @param output Output stream - * @throws IOException If fails */ - public void print(final OutputStream output) throws IOException { + public void print(final OutputStream output) { new Unchecked<>( new LengthOf(new TeeInput(this.text, new OutputTo(output))) ).value(); diff --git a/src/main/java/org/takes/rq/multipart/RqMtFake.java b/src/main/java/org/takes/rq/multipart/RqMtFake.java index 3717a6897..aacb4eedc 100644 --- a/src/main/java/org/takes/rq/multipart/RqMtFake.java +++ b/src/main/java/org/takes/rq/multipart/RqMtFake.java @@ -184,7 +184,7 @@ private FakeBody(final Request... parts) { } @Override - public InputStream body() throws IOException { + public InputStream body() { return new InputStreamOf(this.content::value); } } diff --git a/src/main/java/org/takes/rs/RsJson.java b/src/main/java/org/takes/rs/RsJson.java index 6d5586ed5..4b0536a25 100644 --- a/src/main/java/org/takes/rs/RsJson.java +++ b/src/main/java/org/takes/rs/RsJson.java @@ -104,9 +104,8 @@ public interface Source { /** * Get JSON value. * @return JSON - * @throws IOException If fails */ - JsonStructure toJson() throws IOException; + JsonStructure toJson(); } } diff --git a/src/main/java/org/takes/rs/xe/XeTransform.java b/src/main/java/org/takes/rs/xe/XeTransform.java index 467417ff8..8ec1b70c8 100644 --- a/src/main/java/org/takes/rs/xe/XeTransform.java +++ b/src/main/java/org/takes/rs/xe/XeTransform.java @@ -96,11 +96,7 @@ public boolean hasNext() { @Override public XeSource next() { - try { - return XeTransform.this.func.transform(origin.next()); - } catch (final IOException ex) { - throw new IllegalStateException(ex); - } + return XeTransform.this.func.transform(origin.next()); } @Override @@ -120,8 +116,7 @@ public interface Func { * Transform an object. * @param obj Object * @return Xembly source - * @throws IOException If fails */ - XeSource transform(T obj) throws IOException; + XeSource transform(T obj); } } diff --git a/src/main/java/org/takes/rs/xe/XeWhen.java b/src/main/java/org/takes/rs/xe/XeWhen.java index eaec3c778..79d6cfd1c 100644 --- a/src/main/java/org/takes/rs/xe/XeWhen.java +++ b/src/main/java/org/takes/rs/xe/XeWhen.java @@ -73,7 +73,7 @@ public Boolean value() { source, new Scalar() { @Override - public XeSource value() throws IOException { + public XeSource value() { return XeSource.EMPTY; } } @@ -97,7 +97,7 @@ public XeSource value() { }, new Scalar() { @Override - public XeSource value() throws IOException { + public XeSource value() { return XeSource.EMPTY; } } diff --git a/src/main/java/org/takes/servlet/HttpServletRequestFake.java b/src/main/java/org/takes/servlet/HttpServletRequestFake.java index df2a17d11..c5ac444bf 100644 --- a/src/main/java/org/takes/servlet/HttpServletRequestFake.java +++ b/src/main/java/org/takes/servlet/HttpServletRequestFake.java @@ -319,7 +319,7 @@ public boolean isRequestedSessionIdFromUrl() { @Override public boolean authenticate( final HttpServletResponse resp - ) throws IOException, ServletException { + ) { throw new UnsupportedOperationException("#authenticate()"); } @@ -327,31 +327,31 @@ public boolean authenticate( public void login( final String user, final String password - ) throws ServletException { + ) { throw new UnsupportedOperationException("#login()"); } @Override - public void logout() throws ServletException { + public void logout() { throw new UnsupportedOperationException("#logout()"); } @Override - public Collection getParts() throws IOException, ServletException { + public Collection getParts() { throw new UnsupportedOperationException("#getParts()"); } @Override public Part getPart( final String name - ) throws IOException, ServletException { + ) { throw new UnsupportedOperationException("#getPart()"); } @Override public T upgrade( final Class cls - ) throws IOException, ServletException { + ) { throw new UnsupportedOperationException("#upgrade()"); } @@ -373,7 +373,7 @@ public String getCharacterEncoding() { @Override public void setCharacterEncoding( final String encoding - ) throws UnsupportedEncodingException { + ) { throw new UnsupportedOperationException("#setCharacterEncoding()"); } @@ -423,7 +423,7 @@ public String getScheme() { } @Override - public BufferedReader getReader() throws IOException { + public BufferedReader getReader() { throw new UnsupportedOperationException("#getReader()"); } diff --git a/src/main/java/org/takes/servlet/HttpServletResponseFake.java b/src/main/java/org/takes/servlet/HttpServletResponseFake.java index d7f06c9a4..b35458665 100644 --- a/src/main/java/org/takes/servlet/HttpServletResponseFake.java +++ b/src/main/java/org/takes/servlet/HttpServletResponseFake.java @@ -108,7 +108,7 @@ public void setStatus(final int code) { public void sendError( final int code, final String reason - ) throws IOException { + ) { this.response.set( new RsWithStatus( this.response.get(), @@ -195,12 +195,12 @@ public String encodeRedirectUrl(final String url) { } @Override - public void sendError(final int code) throws IOException { + public void sendError(final int code) { throw new UnsupportedOperationException("#sendError()"); } @Override - public void sendRedirect(final String location) throws IOException { + public void sendRedirect(final String location) { throw new UnsupportedOperationException("#sendRedirect()"); } @@ -261,7 +261,7 @@ public String getContentType() { } @Override - public PrintWriter getWriter() throws IOException { + public PrintWriter getWriter() { throw new UnsupportedOperationException("#getWriter()"); } @@ -296,7 +296,7 @@ public int getBufferSize() { } @Override - public void flushBuffer() throws IOException { + public void flushBuffer() { throw new UnsupportedOperationException("#flushBuffer()"); } diff --git a/src/main/java/org/takes/tk/TkRedirect.java b/src/main/java/org/takes/tk/TkRedirect.java index 1c118195e..a00cbba8f 100644 --- a/src/main/java/org/takes/tk/TkRedirect.java +++ b/src/main/java/org/takes/tk/TkRedirect.java @@ -67,7 +67,7 @@ public TkRedirect(final String location, final int code) { super( new Take() { @Override - public Response act(final Request req) throws IOException { + public Response act(final Request req) { return new RsRedirect(location, code); } } diff --git a/src/test/java/org/takes/facets/auth/IdentityTest.java b/src/test/java/org/takes/facets/auth/IdentityTest.java index 39c4acb27..e5705d5e8 100644 --- a/src/test/java/org/takes/facets/auth/IdentityTest.java +++ b/src/test/java/org/takes/facets/auth/IdentityTest.java @@ -36,10 +36,9 @@ final class IdentityTest { /** * Identity.ANONYMOUS can be equal to itself. - * @throws IOException If some problem inside */ @Test - void equalsToItself() throws IOException { + void equalsToItself() { MatcherAssert.assertThat( Identity.ANONYMOUS, new IsEqual<>(Identity.ANONYMOUS) diff --git a/src/test/java/org/takes/facets/auth/PsBasicDefaultTest.java b/src/test/java/org/takes/facets/auth/PsBasicDefaultTest.java index bc2739181..14c235d36 100644 --- a/src/test/java/org/takes/facets/auth/PsBasicDefaultTest.java +++ b/src/test/java/org/takes/facets/auth/PsBasicDefaultTest.java @@ -36,10 +36,9 @@ final class PsBasicDefaultTest { /** * PsBasic.Default can accept a correct login/password pair. - * @throws Exception If fails */ @Test - void acceptsCorrectLoginPasswordPair() throws Exception { + void acceptsCorrectLoginPasswordPair() { MatcherAssert.assertThat( new PsBasic.Default( new String[]{ @@ -60,10 +59,9 @@ void acceptsCorrectLoginPasswordPair() throws Exception { /** * PsBasic.Default can handle both
%20
and
+
* variants of encoding spaces in constructor parameters. - * @throws Exception If fails */ @Test - void supportsBothKindsOfSpace() throws Exception { + void supportsBothKindsOfSpace() { MatcherAssert.assertThat( new PsBasic.Default( new String[]{ @@ -94,10 +92,9 @@ void supportsBothKindsOfSpace() throws Exception { /** * PsBasic.Default can be entered by a user with a space in his name. - * @throws Exception If fails */ @Test - void supportsUsersWithSpacesInTheirNames() throws Exception { + void supportsUsersWithSpacesInTheirNames() { MatcherAssert.assertThat( new PsBasic.Default( new String[]{ @@ -141,10 +138,9 @@ void supportsUrlencodedUrns() throws Exception { /** * PsBasic.Default can reject incorrect password. - * @throws Exception If fails */ @Test - void rejectsIncorrectPassword() throws Exception { + void rejectsIncorrectPassword() { MatcherAssert.assertThat( new PsBasic.Default( new String[]{ @@ -160,10 +156,9 @@ void rejectsIncorrectPassword() throws Exception { /** * PsBasic.Default can reject a non-existing login. - * @throws Exception If fails */ @Test - void rejectsIncorrectLogin() throws Exception { + void rejectsIncorrectLogin() { MatcherAssert.assertThat( new PsBasic.Default( new String[]{ diff --git a/src/test/java/org/takes/facets/auth/PsByFlagTest.java b/src/test/java/org/takes/facets/auth/PsByFlagTest.java index 873cb1b6d..20e978e06 100644 --- a/src/test/java/org/takes/facets/auth/PsByFlagTest.java +++ b/src/test/java/org/takes/facets/auth/PsByFlagTest.java @@ -85,10 +85,9 @@ void flagIsFoundUserAuthenticated() throws Exception { /** * PsByFlag wraps response with authenticated user. - * @throws IOException If some problem inside */ @Test - void exitTest() throws IOException { + void exitTest() { final Response response = new RsWithStatus( new RsWithType( new RsWithBody("This is test response"), @@ -110,10 +109,9 @@ void exitTest() throws IOException { /** * Checks PsByFlag equals method. - * @throws Exception If some problem inside */ @Test - void mustEvaluateTrueEqualityTest() throws Exception { + void mustEvaluateTrueEqualityTest() { final Map passes = new HashMap<>(1); passes.put(Pattern.compile("key"), new PsFake(true)); new Assertion<>( diff --git a/src/test/java/org/takes/facets/auth/TokenTest.java b/src/test/java/org/takes/facets/auth/TokenTest.java index 0486b745d..b8505ff05 100644 --- a/src/test/java/org/takes/facets/auth/TokenTest.java +++ b/src/test/java/org/takes/facets/auth/TokenTest.java @@ -43,10 +43,9 @@ final class TokenTest { /** * JOSE header has correct algorithm name. - * @throws IOException If some problem inside */ @Test - void joseAlgorithm() throws IOException { + void joseAlgorithm() { // @checkstyle MagicNumber (1 line) final JsonObject jose = new Token.Jose(256).json(); MatcherAssert.assertThat( @@ -75,11 +74,10 @@ void joseEncoded() throws IOException { /** * JWT header exp date is set correctly. - * @throws IOException If some problem inside * @throws ParseException If date parsing fails */ @Test - void jwtExpiration() throws IOException, ParseException { + void jwtExpiration() throws ParseException { final JsonObject jose = new Token.Jwt( (Identity) new Identity.Simple("user"), // @checkstyle MagicNumber (1 line) diff --git a/src/test/java/org/takes/facets/auth/codecs/CcAesTest.java b/src/test/java/org/takes/facets/auth/codecs/CcAesTest.java index adeff426e..0487a05f1 100644 --- a/src/test/java/org/takes/facets/auth/codecs/CcAesTest.java +++ b/src/test/java/org/takes/facets/auth/codecs/CcAesTest.java @@ -140,10 +140,9 @@ void encodesAndDecodes() throws Exception { /** * CcAES can throw the right exception. - * @throws Exception any unexpected exception to throw */ @Test - void throwsRightWhenBroken() throws Exception { + void throwsRightWhenBroken() { Assertions.assertThrows( DecodingException.class, () -> new CcAes( diff --git a/src/test/java/org/takes/facets/auth/codecs/CcBase64Test.java b/src/test/java/org/takes/facets/auth/codecs/CcBase64Test.java index bf1bb9329..0a2e7f7e8 100644 --- a/src/test/java/org/takes/facets/auth/codecs/CcBase64Test.java +++ b/src/test/java/org/takes/facets/auth/codecs/CcBase64Test.java @@ -134,10 +134,9 @@ void decodesNonBaseSixtyFourAlphabetSymbols() throws IOException { /** * Checks CcBase64 equals method. - * @throws Exception If some problem inside */ @Test - void mustEvaluateTrueEquality() throws Exception { + void mustEvaluateTrueEquality() { new Assertion<>( "Must evaluate equality of CcBase64 objects", new CcBase64(new CcPlain()), @@ -146,7 +145,7 @@ void mustEvaluateTrueEquality() throws Exception { } @Test - void mustEvaluateIdenticalHashCodes() throws Exception { + void mustEvaluateIdenticalHashCodes() { new Assertion<>( "Must evaluate identical hash codes", new CcBase64(new CcPlain()).hashCode(), diff --git a/src/test/java/org/takes/facets/auth/codecs/CcGzipTest.java b/src/test/java/org/takes/facets/auth/codecs/CcGzipTest.java index a9ddd0c20..9672e0a44 100644 --- a/src/test/java/org/takes/facets/auth/codecs/CcGzipTest.java +++ b/src/test/java/org/takes/facets/auth/codecs/CcGzipTest.java @@ -45,13 +45,12 @@ void compressesAndDecompresses() throws Exception { final Codec gzip = new CcGzip( new Codec() { @Override - public byte[] encode(final Identity identity) - throws IOException { + public byte[] encode(final Identity identity) { return identity.urn().getBytes(); } @Override - public Identity decode(final byte[] bytes) throws IOException { + public Identity decode(final byte[] bytes) { return new Identity.Simple(new String(bytes)); } } diff --git a/src/test/java/org/takes/facets/auth/codecs/CcSaltedTest.java b/src/test/java/org/takes/facets/auth/codecs/CcSaltedTest.java index 38b7057c2..057c497fc 100644 --- a/src/test/java/org/takes/facets/auth/codecs/CcSaltedTest.java +++ b/src/test/java/org/takes/facets/auth/codecs/CcSaltedTest.java @@ -72,10 +72,9 @@ void encryptsLargeData() throws IOException { /** * CcSalted can throw when incomplete data. - * @throws IOException If some problem inside */ @Test - void throwsOnIncompleteData() throws IOException { + void throwsOnIncompleteData() { Assertions.assertThrows( DecodingException.class, () -> new CcSalted(new CcPlain()).decode( @@ -86,10 +85,9 @@ void throwsOnIncompleteData() throws IOException { /** * CcSalted can throw when length of salt is negative. - * @throws IOException If some problem inside */ @Test - void throwsOnZeroData() throws IOException { + void throwsOnZeroData() { Assertions.assertThrows( DecodingException.class, () -> new CcSalted(new CcPlain()).decode( @@ -100,10 +98,9 @@ void throwsOnZeroData() throws IOException { /** * CcSalted can throw on empty input. - * @throws IOException If some problem inside */ @Test - void throwsOnEmptyInput() throws IOException { + void throwsOnEmptyInput() { Assertions.assertThrows( DecodingException.class, () -> new CcSalted(new CcPlain()).decode(new byte[0]) diff --git a/src/test/java/org/takes/facets/auth/signatures/SiHmacTest.java b/src/test/java/org/takes/facets/auth/signatures/SiHmacTest.java index d540df54a..8abb4a7e0 100644 --- a/src/test/java/org/takes/facets/auth/signatures/SiHmacTest.java +++ b/src/test/java/org/takes/facets/auth/signatures/SiHmacTest.java @@ -35,10 +35,9 @@ @SuppressWarnings("PMD.AvoidDuplicateLiterals") final class SiHmacTest { /** * SiHmac corrects wrong bit length. - * @throws IOException If some problem inside */ @Test - void corrects() throws IOException { + void corrects() { new Assertion<>( "Must have proper bit length", // @checkstyle MagicNumber (1 line) @@ -69,10 +68,9 @@ void signs() throws IOException { /** * Checks SiHmac equals method. - * @throws Exception If some problem inside */ @Test - void mustEvaluateTrueEqualityTest() throws Exception { + void mustEvaluateTrueEqualityTest() { final String key = "key"; new Assertion<>( "Must evaluate true equality", diff --git a/src/test/java/org/takes/facets/auth/social/PsGithubTest.java b/src/test/java/org/takes/facets/auth/social/PsGithubTest.java index f74dc5dff..8cd5a0e4f 100644 --- a/src/test/java/org/takes/facets/auth/social/PsGithubTest.java +++ b/src/test/java/org/takes/facets/auth/social/PsGithubTest.java @@ -82,10 +82,9 @@ final class PsGithubTest { /** * PsGithub can fail on no access token. - * @throws Exception If some problem inside. */ @Test - void failsOnNoAccessToken() throws Exception { + void failsOnNoAccessToken() { Assertions.assertThrows( AssertionError.class, () -> this.performLogin(PsGithubTest.directiveWithoutAccessToken()) diff --git a/src/test/java/org/takes/facets/fork/FkContentTypeTest.java b/src/test/java/org/takes/facets/fork/FkContentTypeTest.java index 5cedd8b12..ff8d04f9a 100644 --- a/src/test/java/org/takes/facets/fork/FkContentTypeTest.java +++ b/src/test/java/org/takes/facets/fork/FkContentTypeTest.java @@ -154,10 +154,9 @@ void matchesDifferentEncodingsTypes() throws Exception { /** * Checks FkContentType equals method. - * @throws Exception If some problem inside */ @Test - void mustEvaluateEqualsTest() throws Exception { + void mustEvaluateEqualsTest() { final Take take = req -> new RsEmpty(); final String type = "text/xml"; new Assertion<>( @@ -174,7 +173,7 @@ void mustEvaluateEqualsTest() throws Exception { private static Take emptyResponse() { return new Take() { @Override - public Response act(final Request req) throws IOException { + public Response act(final Request req) { return new RsEmpty(); } }; diff --git a/src/test/java/org/takes/facets/fork/MediaTypeTest.java b/src/test/java/org/takes/facets/fork/MediaTypeTest.java index 541f12231..604914fad 100644 --- a/src/test/java/org/takes/facets/fork/MediaTypeTest.java +++ b/src/test/java/org/takes/facets/fork/MediaTypeTest.java @@ -36,10 +36,9 @@ final class MediaTypeTest { /** * MediaType can match two types. - * @throws IOException If some problem inside */ @Test - void matchesTwoTypes() throws IOException { + void matchesTwoTypes() { MatcherAssert.assertThat( new MediaType("*/*").matches(new MediaType("application/pdf")), Matchers.is(true) @@ -66,10 +65,9 @@ void matchesTwoTypes() throws IOException { /** * MediaType can match two types. - * @throws IOException If some problem inside */ @Test - void comparesTwoTypes() throws IOException { + void comparesTwoTypes() { MatcherAssert.assertThat( new MediaType("text/b").compareTo(new MediaType("text/a")), Matchers.not(Matchers.equalTo(0)) @@ -78,10 +76,9 @@ void comparesTwoTypes() throws IOException { /** * MediaType can parse invalid types. - * @throws IOException If some problem inside */ @Test - void parsesInvalidTypes() throws IOException { + void parsesInvalidTypes() { new MediaType("hello, how are you?"); new MediaType("////"); new MediaType("/;/;q=0.9"); diff --git a/src/test/java/org/takes/facets/fork/MediaTypesTest.java b/src/test/java/org/takes/facets/fork/MediaTypesTest.java index dcf608761..5011b42c0 100644 --- a/src/test/java/org/takes/facets/fork/MediaTypesTest.java +++ b/src/test/java/org/takes/facets/fork/MediaTypesTest.java @@ -36,10 +36,9 @@ final class MediaTypesTest { /** * MediaTypes can match two lists. - * @throws IOException If some problem inside */ @Test - void matchesTwoTypes() throws IOException { + void matchesTwoTypes() { MatcherAssert.assertThat( new MediaTypes("*/*").contains( new MediaTypes("application/xml") @@ -74,10 +73,9 @@ void matchesTwoTypes() throws IOException { /** * MediaTypes can match two composite lists. - * @throws IOException If some problem inside */ @Test - void matchesTwoCompositeTypes() throws IOException { + void matchesTwoCompositeTypes() { MatcherAssert.assertThat( new MediaTypes("text/xml,text/json").contains( new MediaTypes("text/json") @@ -94,10 +92,9 @@ void matchesTwoCompositeTypes() throws IOException { /** * MediaTypes can parse invalid types. - * @throws IOException If some problem inside */ @Test - void parsesInvalidTypes() throws IOException { + void parsesInvalidTypes() { new MediaTypes("hello, how are you?"); new MediaTypes("////"); new MediaTypes("/;/;q=0.9"); diff --git a/src/test/java/org/takes/facets/fork/RqRegexTest.java b/src/test/java/org/takes/facets/fork/RqRegexTest.java index 9aca8c074..111f20575 100644 --- a/src/test/java/org/takes/facets/fork/RqRegexTest.java +++ b/src/test/java/org/takes/facets/fork/RqRegexTest.java @@ -36,10 +36,9 @@ final class RqRegexTest { /** * RqRegex can match a string. - * @throws IOException If some problem inside */ @Test - void matchesString() throws IOException { + void matchesString() { MatcherAssert.assertThat( new RqRegex.Fake("/([a-z\\.]+)", "/hello.txt").matcher().group(1), Matchers.equalTo("hello.txt") diff --git a/src/test/java/org/takes/facets/hamcrest/HmHeaderTest.java b/src/test/java/org/takes/facets/hamcrest/HmHeaderTest.java index e13da27b0..6b354bc7a 100644 --- a/src/test/java/org/takes/facets/hamcrest/HmHeaderTest.java +++ b/src/test/java/org/takes/facets/hamcrest/HmHeaderTest.java @@ -41,10 +41,9 @@ final class HmHeaderTest { /** * HmRqHeader can test whether a header is available. - * @throws Exception If some problem inside */ @Test - void testsHeaderAvailable() throws Exception { + void testsHeaderAvailable() { MatcherAssert.assertThat( new RqFake( Arrays.asList( @@ -63,10 +62,9 @@ void testsHeaderAvailable() throws Exception { /** * HmRqHeader can test whether a header value is not available. - * @throws Exception If some problem inside */ @Test - void testsHeaderValueNotAvailable() throws Exception { + void testsHeaderValueNotAvailable() { MatcherAssert.assertThat( new RqFake( Arrays.asList( @@ -86,10 +84,9 @@ void testsHeaderValueNotAvailable() throws Exception { /** * HmRqHeader can test whether header name and value are available. - * @throws Exception If some problem inside */ @Test - void testsHeaderNameAndValueAvailable() throws Exception { + void testsHeaderNameAndValueAvailable() { MatcherAssert.assertThat( new RqWithHeader(new RqFake(), "header1: value1"), new HmHeader<>( @@ -101,10 +98,9 @@ void testsHeaderNameAndValueAvailable() throws Exception { /** * HmRqHeader can test whether header name is available * and value is not available. - * @throws Exception If some problem inside */ @Test - void testsValueNotAvailable() throws Exception { + void testsValueNotAvailable() { MatcherAssert.assertThat( new RqWithHeader(new RqFake(), "header2: value2"), Matchers.not( @@ -117,10 +113,9 @@ void testsValueNotAvailable() throws Exception { /** * HmRqHeader can test whether multiple headers are available. - * @throws Exception If some problem inside */ @Test - void testsMultipleHeadersAvailable() throws Exception { + void testsMultipleHeadersAvailable() { MatcherAssert.assertThat( new RqWithHeaders( new RqFake(), @@ -134,10 +129,9 @@ void testsMultipleHeadersAvailable() throws Exception { /** * HmRqHeader can test whether a header is not available. - * @throws Exception If some problem inside */ @Test - void testsHeaderNotAvailable() throws Exception { + void testsHeaderNotAvailable() { MatcherAssert.assertThat( new RqWithHeaders(new RqFake(), "header4: value4"), new HmHeader<>( diff --git a/src/test/java/org/takes/facets/hamcrest/HmTextBodyTest.java b/src/test/java/org/takes/facets/hamcrest/HmTextBodyTest.java index b5ea2a164..dc64573e5 100644 --- a/src/test/java/org/takes/facets/hamcrest/HmTextBodyTest.java +++ b/src/test/java/org/takes/facets/hamcrest/HmTextBodyTest.java @@ -95,7 +95,7 @@ private final class HmTextBodyFake extends AbstractHmTextBody { } @Override - public InputStream itemBody(final Text item) throws IOException { + public InputStream itemBody(final Text item) { return new InputStreamOf(item); } } diff --git a/src/test/java/org/takes/http/OptionsTest.java b/src/test/java/org/takes/http/OptionsTest.java index 0fcb75d90..9cee2b567 100644 --- a/src/test/java/org/takes/http/OptionsTest.java +++ b/src/test/java/org/takes/http/OptionsTest.java @@ -35,10 +35,9 @@ final class OptionsTest { /** * Options can parse command line arguments. - * @throws Exception If some problem inside */ @Test - void understandsCommandLineArgs() throws Exception { + void understandsCommandLineArgs() { final Options opts = new Options( "--hit-refresh --threads=2".split(" ") ); diff --git a/src/test/java/org/takes/rq/RqSocketTest.java b/src/test/java/org/takes/rq/RqSocketTest.java index fca48b5e8..bd9833d72 100644 --- a/src/test/java/org/takes/rq/RqSocketTest.java +++ b/src/test/java/org/takes/rq/RqSocketTest.java @@ -209,10 +209,9 @@ void returnNotFoundLocalPort() { /** * Checks RqSocket equals method. - * @throws Exception If some problem inside */ @Test - void mustEqualToSameTypeRequest() throws Exception { + void mustEqualToSameTypeRequest() { final Request request = new RqWithHeader( new RqFake(), "X-Takes-LocalPort: 55555" ); diff --git a/src/test/java/org/takes/rq/RqWithHeadersTest.java b/src/test/java/org/takes/rq/RqWithHeadersTest.java index 1cbdba156..abff069d1 100644 --- a/src/test/java/org/takes/rq/RqWithHeadersTest.java +++ b/src/test/java/org/takes/rq/RqWithHeadersTest.java @@ -73,10 +73,9 @@ void addsHeadersToRequest() throws IOException { /** * Checks RqWithHeaders equals method. - * @throws Exception If some problem inside */ @Test - void mustEqualTest() throws Exception { + void mustEqualTest() { final Request request = new RqWithHeader( new RqFake(), "jsessionid", "abcdefghigklmnop" diff --git a/src/test/java/org/takes/rs/HeadPrintTest.java b/src/test/java/org/takes/rs/HeadPrintTest.java index 022a87c62..cf10d0a6d 100644 --- a/src/test/java/org/takes/rs/HeadPrintTest.java +++ b/src/test/java/org/takes/rs/HeadPrintTest.java @@ -39,9 +39,8 @@ final class HeadPrintTest { /** * HeadPrint can fail on invalid chars. - * @throws IOException If some problem inside */ - void failsOnInvalidHeader() throws IOException { + void failsOnInvalidHeader() { MatcherAssert.assertThat( "Must catch invalid header exception", () -> new HeadPrint( @@ -52,7 +51,7 @@ void failsOnInvalidHeader() throws IOException { } @Test - void simple() throws IOException { + void simple() { MatcherAssert.assertThat( "must write head", new HeadPrint( @@ -66,7 +65,7 @@ void simple() throws IOException { * RFC 7230 says we shall support dashes in response first line. */ @Test - void simpleWithDash() throws IOException { + void simpleWithDash() { new Assertion<>( "must write head with dashes", new HeadPrint( diff --git a/src/test/java/org/takes/rs/RsPrettyJsonTest.java b/src/test/java/org/takes/rs/RsPrettyJsonTest.java index 460b89972..c7a7d0e72 100644 --- a/src/test/java/org/takes/rs/RsPrettyJsonTest.java +++ b/src/test/java/org/takes/rs/RsPrettyJsonTest.java @@ -104,10 +104,9 @@ void reportsCorrectContentLength() throws Exception { /** * RsPrettyJSON can conform to equals. - * @throws Exception If some problem inside */ @Test - void mustEvaluateTrueEquality() throws Exception { + void mustEvaluateTrueEquality() { final String body = "{\"person\":{\"name\":\"John\"}}"; new Assertion<>( "Must evaluate true equality", diff --git a/src/test/java/org/takes/rs/RsPrettyXmlTest.java b/src/test/java/org/takes/rs/RsPrettyXmlTest.java index d928cc593..c5fed76a8 100644 --- a/src/test/java/org/takes/rs/RsPrettyXmlTest.java +++ b/src/test/java/org/takes/rs/RsPrettyXmlTest.java @@ -202,10 +202,9 @@ void reportsCorrectContentLength() throws IOException { /** * RsPrettyXML can conform to equals and hash code contract. - * @throws Exception If some problem inside */ @Test - void conformsToEqualsTest() throws Exception { + void conformsToEqualsTest() { final Response response = new RsWithBody(" test"); new Assertion<>( "Must evaluate true equality", diff --git a/src/test/java/org/takes/rs/RsRedirectTest.java b/src/test/java/org/takes/rs/RsRedirectTest.java index d7a781f7d..6ab2205a5 100644 --- a/src/test/java/org/takes/rs/RsRedirectTest.java +++ b/src/test/java/org/takes/rs/RsRedirectTest.java @@ -36,10 +36,9 @@ final class RsRedirectTest { /** * RsRedirect can redirect. - * @throws IOException If some problem inside */ @Test - void redirects() throws IOException { + void redirects() { MatcherAssert.assertThat( new RsPrint( new RsRedirect( diff --git a/src/test/java/org/takes/rs/RsTextTest.java b/src/test/java/org/takes/rs/RsTextTest.java index 8d55a497b..0f2010ed2 100644 --- a/src/test/java/org/takes/rs/RsTextTest.java +++ b/src/test/java/org/takes/rs/RsTextTest.java @@ -39,10 +39,9 @@ final class RsTextTest { /** * RsText can build a plain text response. - * @throws IOException If some problem inside */ @Test - void makesPlainTextResponse() throws IOException { + void makesPlainTextResponse() { final String body = "hello, world!"; MatcherAssert.assertThat( new RsPrint(new RsBuffered(new RsText(body))), diff --git a/src/test/java/org/takes/rs/RsWithHeaderTest.java b/src/test/java/org/takes/rs/RsWithHeaderTest.java index 61665cad0..d6235ca38 100644 --- a/src/test/java/org/takes/rs/RsWithHeaderTest.java +++ b/src/test/java/org/takes/rs/RsWithHeaderTest.java @@ -38,10 +38,9 @@ final class RsWithHeaderTest { /** * RsWithHeader can add headers. - * @throws IOException If some problem inside */ @Test - void addsHeadersToResponse() throws IOException { + void addsHeadersToResponse() { MatcherAssert.assertThat( new RsPrint( new RsWithHeader( diff --git a/src/test/java/org/takes/rs/RsWithHeadersTest.java b/src/test/java/org/takes/rs/RsWithHeadersTest.java index c943b546a..a4cb3156c 100644 --- a/src/test/java/org/takes/rs/RsWithHeadersTest.java +++ b/src/test/java/org/takes/rs/RsWithHeadersTest.java @@ -37,10 +37,9 @@ final class RsWithHeadersTest { /** * RsWithHeaders can add headers. - * @throws IOException If some problem inside */ @Test - void addsHeadersToResponse() throws IOException { + void addsHeadersToResponse() { final String host = "Host: www.example.com"; final String type = "Content-Type: text/xml"; MatcherAssert.assertThat( diff --git a/src/test/java/org/takes/rs/RsWithTypeTest.java b/src/test/java/org/takes/rs/RsWithTypeTest.java index 5ba3d214e..961e9cbe4 100644 --- a/src/test/java/org/takes/rs/RsWithTypeTest.java +++ b/src/test/java/org/takes/rs/RsWithTypeTest.java @@ -80,10 +80,9 @@ final class RsWithTypeTest { /** * RsWithType can replace an existing type. - * @throws Exception If a problem occurs. */ @Test - void replaceTypeToResponse() throws Exception { + void replaceTypeToResponse() { final String type = RsWithTypeTest.TYPE_TEXT; MatcherAssert.assertThat( new RsPrint( @@ -106,10 +105,9 @@ void replaceTypeToResponse() throws Exception { /** * RsWithType does not replace response code. - * @throws Exception If a problem occurs. */ @Test - void doesNotReplaceResponseCode() throws Exception { + void doesNotReplaceResponseCode() { final String body = "Error!"; MatcherAssert.assertThat( new RsPrint( @@ -136,10 +134,9 @@ void doesNotReplaceResponseCode() throws Exception { /** * RsWithType.HTML can replace an existing type with text/html. - * @throws Exception If a problem occurs. */ @Test - void replacesTypeWithHtml() throws Exception { + void replacesTypeWithHtml() { MatcherAssert.assertThat( new RsPrint( new RsWithType.Html( @@ -184,10 +181,9 @@ void replacesTypeWithHtml() throws Exception { /** * RsWithType.JSON can replace an existing type with application/json. - * @throws Exception If a problem occurs. */ @Test - void replacesTypeWithJson() throws Exception { + void replacesTypeWithJson() { MatcherAssert.assertThat( new RsPrint( new RsWithType.Json( @@ -232,10 +228,9 @@ void replacesTypeWithJson() throws Exception { /** * RsWithType.XML can replace an existing type with text/xml. - * @throws Exception If a problem occurs. */ @Test - void replacesTypeWithXml() throws Exception { + void replacesTypeWithXml() { MatcherAssert.assertThat( new RsPrint( new RsWithType.Xml( @@ -279,10 +274,9 @@ void replacesTypeWithXml() throws Exception { /** * RsWithType.Text can replace an existing type with text/plain. - * @throws Exception If a problem occurs. */ @Test - void replacesTypeWithText() throws Exception { + void replacesTypeWithText() { MatcherAssert.assertThat( new RsPrint( new RsWithType.Text( @@ -326,10 +320,9 @@ void replacesTypeWithText() throws Exception { /** * RsWithType can add properly the content type to the header. - * @throws Exception If a problem occurs. */ @Test - void addsContentType() throws Exception { + void addsContentType() { MatcherAssert.assertThat( new RsPrint( new RsWithType(new RsEmpty(), RsWithTypeTest.TYPE_TEXT) @@ -352,10 +345,9 @@ void addsContentType() throws Exception { /** * RsWithType can add the charset to the content type when it is explicitly * specified. - * @throws Exception If a problem occurs. */ @Test - void addsCharsetToContentType() throws Exception { + void addsCharsetToContentType() { MatcherAssert.assertThat( new RsPrint( new RsWithType( diff --git a/src/test/java/org/takes/rs/RsXsltTest.java b/src/test/java/org/takes/rs/RsXsltTest.java index 2204f6137..e1c531ab4 100644 --- a/src/test/java/org/takes/rs/RsXsltTest.java +++ b/src/test/java/org/takes/rs/RsXsltTest.java @@ -92,10 +92,9 @@ void convertsXmlToHtml() throws IOException { /** * RsXSLT can convert XML to plain text. - * @throws IOException If some problem inside */ @Test - void convertsXmlToPlainText() throws IOException { + void convertsXmlToPlainText() { final Text xml = new Joined( " ", "", @@ -122,10 +121,9 @@ void convertsXmlToPlainText() throws IOException { /** * RsXSLT closes decorated Response body's InputStream when XML conversion * is done. - * @throws Exception If some problem inside */ @Test - void closesDecoratedResponseInputStream() throws Exception { + void closesDecoratedResponseInputStream() { final Text xml = new Joined( " ", "", @@ -159,10 +157,9 @@ void closesDecoratedResponseInputStream() throws Exception { /** * RsXSLT can resolve in classpath. - * @throws IOException If some problem inside */ @Test - void resolvesInClasspath() throws IOException { + void resolvesInClasspath() { MatcherAssert.assertThat( new RsPrint( new RsXslt( diff --git a/src/test/java/org/takes/rs/xe/XeWhenTest.java b/src/test/java/org/takes/rs/xe/XeWhenTest.java index b253937e9..66130c1c5 100644 --- a/src/test/java/org/takes/rs/xe/XeWhenTest.java +++ b/src/test/java/org/takes/rs/xe/XeWhenTest.java @@ -110,13 +110,13 @@ void buildsXmlResponseFromNegativeCondition() throws Exception { false, new Scalar() { @Override - public XeSource value() throws IOException { + public XeSource value() { return new XeDate(); } }, new Scalar() { @Override - public XeSource value() throws IOException { + public XeSource value() { return new XeMemory(); } }) diff --git a/src/test/java/org/takes/servlet/SrvTakeTest.java b/src/test/java/org/takes/servlet/SrvTakeTest.java index fd4def9c1..70ade4d1c 100644 --- a/src/test/java/org/takes/servlet/SrvTakeTest.java +++ b/src/test/java/org/takes/servlet/SrvTakeTest.java @@ -101,7 +101,7 @@ final class TkApp implements Take { } @Override - public Response act(final Request req) throws IOException { + public Response act(final Request req) { return new RsText( new UncheckedText( new FormattedText( diff --git a/src/test/java/org/takes/tk/TkReadAlwaysTest.java b/src/test/java/org/takes/tk/TkReadAlwaysTest.java index 47a677488..c4d09892b 100644 --- a/src/test/java/org/takes/tk/TkReadAlwaysTest.java +++ b/src/test/java/org/takes/tk/TkReadAlwaysTest.java @@ -51,7 +51,7 @@ void requestBodyIsIgnored() throws Exception { final String expected = "response ok"; final Take take = new Take() { @Override - public Response act(final Request req) throws IOException { + public Response act(final Request req) { return new RsText(expected); } }; diff --git a/src/test/java/org/takes/tk/TkSlf4jTest.java b/src/test/java/org/takes/tk/TkSlf4jTest.java index 6c42bc512..3d5ec3d66 100644 --- a/src/test/java/org/takes/tk/TkSlf4jTest.java +++ b/src/test/java/org/takes/tk/TkSlf4jTest.java @@ -71,10 +71,9 @@ void logsRuntimeException() { /** * TkSlf4j can work with {@link TkEmpty}. - * @throws Exception If some problem inside */ @Test - void logsEmptyMessage() throws Exception { + void logsEmptyMessage() { final Take take = new TkSlf4j(new TkEmpty()); Assertions.assertDoesNotThrow( () -> take.act(new RqFake())