From 2c9a15eb723a5a555f60393d82c215becabc1c0b Mon Sep 17 00:00:00 2001 From: Yegor Bugayenko Date: Mon, 28 Oct 2024 13:42:17 +0300 Subject: [PATCH] better error messge --- src/main/java/org/cactoos/Fallback.java | 2 +- .../cactoos/io/CloseShieldInputStream.java | 2 +- .../cactoos/io/CloseShieldOutputStream.java | 2 +- .../java/org/cactoos/io/HeadInputStream.java | 6 +- .../org/cactoos/io/LoggingInputStream.java | 2 +- .../org/cactoos/io/LoggingOutputStream.java | 2 +- src/main/java/org/cactoos/io/ResourceOf.java | 5 +- src/main/java/org/cactoos/number/AvgOf.java | 4 +- .../java/org/cactoos/scalar/Equality.java | 2 +- .../java/org/cactoos/scalar/LengthOf.java | 2 +- .../java/org/cactoos/text/Abbreviated.java | 2 +- src/main/java/org/cactoos/text/HexOf.java | 2 +- .../java/org/cactoos/text/TextOfString.java | 2 +- src/main/java/org/cactoos/time/DateOf.java | 2 +- .../cactoos/bytes/EmptyClosableReader.java | 6 +- .../java/org/cactoos/bytes/HexOfTest.java | 6 +- .../org/cactoos/bytes/InputAsBytesTest.java | 4 +- .../org/cactoos/bytes/ReaderAsBytesTest.java | 2 +- .../org/cactoos/experimental/ThreadsTest.java | 38 +++++------ src/test/java/org/cactoos/func/AsyncTest.java | 4 +- .../java/org/cactoos/func/BiFuncOfTest.java | 6 +- .../java/org/cactoos/func/ChainedTest.java | 4 +- .../java/org/cactoos/func/FuncOfTest.java | 6 +- .../java/org/cactoos/io/FakeInputStream.java | 5 +- .../java/org/cactoos/io/FakeOutputStream.java | 5 +- src/test/java/org/cactoos/io/HeadOfTest.java | 6 +- src/test/java/org/cactoos/io/InputOfTest.java | 14 ++-- .../java/org/cactoos/io/LoggingInputTest.java | 2 +- .../org/cactoos/io/OutputStreamToTest.java | 3 +- .../java/org/cactoos/io/ReaderOfTest.java | 40 +++++------ .../java/org/cactoos/io/ResourceOfTest.java | 10 +-- .../java/org/cactoos/io/SlowInputTest.java | 4 +- src/test/java/org/cactoos/io/TailOfTest.java | 2 +- .../java/org/cactoos/iterable/CycledTest.java | 2 +- .../org/cactoos/iterable/FilteredTest.java | 6 +- .../java/org/cactoos/iterable/HeadOfTest.java | 2 +- .../iterable/IterableOfDoublesTest.java | 2 +- .../iterable/IterableOfFloatsTest.java | 2 +- .../cactoos/iterable/IterableOfLongsTest.java | 2 +- .../iterable/IterableOfShortsTest.java | 2 +- .../org/cactoos/iterable/IterableOfTest.java | 4 +- .../java/org/cactoos/iterable/MappedTest.java | 2 +- .../cactoos/iterable/MappedWithIndexTest.java | 2 +- .../org/cactoos/iterable/MatchedTest.java | 4 +- .../org/cactoos/iterable/PartitionedTest.java | 4 +- .../org/cactoos/iterable/RangeOfTest.java | 4 +- .../org/cactoos/iterable/RepeatedTest.java | 6 +- .../org/cactoos/iterable/ShuffledTest.java | 2 +- .../java/org/cactoos/iterable/SlicedTest.java | 2 +- .../java/org/cactoos/iterable/SortedTest.java | 8 +-- .../java/org/cactoos/iterable/TailOfTest.java | 2 +- .../cactoos/iterator/IteratorOfBytesTest.java | 4 +- .../cactoos/iterator/IteratorOfLongsTest.java | 4 +- .../org/cactoos/iterator/PartitionedTest.java | 2 +- .../org/cactoos/iterator/RangeOfTest.java | 4 +- .../java/org/cactoos/list/JoinedTest.java | 4 +- .../java/org/cactoos/list/ListOfTest.java | 10 +-- .../java/org/cactoos/map/GroupedTest.java | 8 +-- .../cactoos/number/NumberEnvelopeTest.java | 23 ++++--- .../cactoos/number/NumberOfScalarsTest.java | 23 ++++--- .../java/org/cactoos/number/NumberOfTest.java | 21 +++--- .../java/org/cactoos/proc/BiProcOfTest.java | 10 +-- .../java/org/cactoos/proc/ProcOfTest.java | 4 +- .../org/cactoos/proc/RepeatedProcTest.java | 2 +- .../org/cactoos/scalar/AndInThreadsTest.java | 66 +++++++++++-------- .../java/org/cactoos/scalar/BoolOfTest.java | 6 +- .../java/org/cactoos/scalar/CheckedTest.java | 10 +-- .../java/org/cactoos/scalar/ConstantTest.java | 4 +- .../java/org/cactoos/scalar/EqualityTest.java | 12 ++-- .../cactoos/scalar/EqualsNullableTest.java | 10 +-- .../java/org/cactoos/scalar/EqualsTest.java | 10 +-- .../java/org/cactoos/scalar/FalseTest.java | 4 +- .../java/org/cactoos/scalar/FoldedTest.java | 4 +- .../org/cactoos/scalar/HighestOfTest.java | 2 +- .../java/org/cactoos/scalar/LengthOfTest.java | 4 +- .../java/org/cactoos/scalar/LowestOfTest.java | 2 +- .../java/org/cactoos/scalar/MappedTest.java | 2 +- .../java/org/cactoos/scalar/RetryTest.java | 4 +- .../scalar/ScalarWithFallbackTest.java | 16 ++--- .../java/org/cactoos/scalar/TernaryTest.java | 14 ++-- .../org/cactoos/scalar/ThrowsOnFalseTest.java | 4 +- .../java/org/cactoos/scalar/TrueTest.java | 2 +- src/test/java/org/cactoos/scalar/XorTest.java | 22 +++---- .../org/cactoos/text/Base64DecodedTest.java | 4 +- .../org/cactoos/text/Base64EncodedTest.java | 4 +- src/test/java/org/cactoos/text/HexOfTest.java | 3 +- src/test/java/org/cactoos/text/SplitTest.java | 20 +++--- .../org/cactoos/text/TextOfDateTimeTest.java | 3 +- 88 files changed, 305 insertions(+), 308 deletions(-) diff --git a/src/main/java/org/cactoos/Fallback.java b/src/main/java/org/cactoos/Fallback.java index 2af5ea9c8..a59e4673b 100644 --- a/src/main/java/org/cactoos/Fallback.java +++ b/src/main/java/org/cactoos/Fallback.java @@ -118,7 +118,7 @@ public int support(final Throwable exception) { } @Override - public X apply(final Throwable input) throws Exception { + public X apply(final Throwable input) { throw new IllegalStateException(input); } } diff --git a/src/main/java/org/cactoos/io/CloseShieldInputStream.java b/src/main/java/org/cactoos/io/CloseShieldInputStream.java index a57bd2f23..adc029976 100644 --- a/src/main/java/org/cactoos/io/CloseShieldInputStream.java +++ b/src/main/java/org/cactoos/io/CloseShieldInputStream.java @@ -68,7 +68,7 @@ public int read(final byte[] buffer, final int offset, } @Override - public void close() throws IOException { + public void close() { this.inner.set(new DeadInputStream()); } diff --git a/src/main/java/org/cactoos/io/CloseShieldOutputStream.java b/src/main/java/org/cactoos/io/CloseShieldOutputStream.java index 6ebe9c321..cd580f851 100644 --- a/src/main/java/org/cactoos/io/CloseShieldOutputStream.java +++ b/src/main/java/org/cactoos/io/CloseShieldOutputStream.java @@ -73,7 +73,7 @@ public void flush() throws IOException { } @Override - public void close() throws IOException { + public void close() { this.inner.set(new DeadOutputStream()); } diff --git a/src/main/java/org/cactoos/io/HeadInputStream.java b/src/main/java/org/cactoos/io/HeadInputStream.java index 05acd1d54..e02b74ad2 100644 --- a/src/main/java/org/cactoos/io/HeadInputStream.java +++ b/src/main/java/org/cactoos/io/HeadInputStream.java @@ -58,7 +58,7 @@ public final class HeadInputStream extends InputStream { public HeadInputStream(final InputStream orig, final int len) { super(); this.origin = orig; - this.length = len; + this.length = (long) len; } @Override @@ -67,7 +67,7 @@ public int read() throws IOException { if (this.processed >= this.length) { adjusted = -1; } else { - this.processed += 1; + this.processed += 1L; adjusted = this.origin.read(); } return adjusted; @@ -96,7 +96,7 @@ public void reset() throws IOException { public int available() throws IOException { final int available = this.origin.available(); final int adjusted; - if (this.processed + available > this.length) { + if (this.processed + (long) available > this.length) { adjusted = (int) (this.length - this.processed); } else { adjusted = available; diff --git a/src/main/java/org/cactoos/io/LoggingInputStream.java b/src/main/java/org/cactoos/io/LoggingInputStream.java index af57d52f0..044082c1a 100644 --- a/src/main/java/org/cactoos/io/LoggingInputStream.java +++ b/src/main/java/org/cactoos/io/LoggingInputStream.java @@ -142,7 +142,7 @@ public int read(final byte[] buf, final int offset, final int len) final int byts = this.origin.read(buf, offset, len); final Instant end = Instant.now(); if (byts > 0) { - this.bytes.getAndAdd(byts); + this.bytes.getAndAdd((long) byts); final long millis = Duration.between(start, end).toMillis(); this.time.getAndAdd(millis); } diff --git a/src/main/java/org/cactoos/io/LoggingOutputStream.java b/src/main/java/org/cactoos/io/LoggingOutputStream.java index 2a27e8ee9..84b0f724f 100644 --- a/src/main/java/org/cactoos/io/LoggingOutputStream.java +++ b/src/main/java/org/cactoos/io/LoggingOutputStream.java @@ -118,7 +118,7 @@ public void write(final byte[] buf, final int offset, final Instant start = Instant.now(); this.origin.write(buf, offset, len); final Instant end = Instant.now(); - this.bytes.getAndAdd(len); + this.bytes.getAndAdd((long) len); final long millis = Duration.between(start, end).toMillis(); this.time.getAndAdd(millis); final Level level = this.logger.getLevel(); diff --git a/src/main/java/org/cactoos/io/ResourceOf.java b/src/main/java/org/cactoos/io/ResourceOf.java index 9d7d6b2be..7aa7cd273 100644 --- a/src/main/java/org/cactoos/io/ResourceOf.java +++ b/src/main/java/org/cactoos/io/ResourceOf.java @@ -160,9 +160,10 @@ public ResourceOf(final Text res, final ClassLoader ldr) { input -> { throw new IOException( new FormattedText( - "The resource \"%s\" was not found in %s", + "The resource \"%s\" was not found in %s (%s)", input, - ldr + ldr, + ldr.getClass().getCanonicalName() ).asString() ); }, diff --git a/src/main/java/org/cactoos/number/AvgOf.java b/src/main/java/org/cactoos/number/AvgOf.java index 7a07ee8a3..898d177f9 100644 --- a/src/main/java/org/cactoos/number/AvgOf.java +++ b/src/main/java/org/cactoos/number/AvgOf.java @@ -72,9 +72,9 @@ public AvgOf(final Iterable src) { (Iterator it) -> it.hasNext(), it -> { BigDecimal total = BigDecimal.ZERO; - long qty = 0; + long qty = 0L; for (final Number value: new IterableOf<>(it)) { - qty += 1; + qty += 1L; total = total.add( new BigDecimal(value.toString()) ); diff --git a/src/main/java/org/cactoos/scalar/Equality.java b/src/main/java/org/cactoos/scalar/Equality.java index da27e5e2e..bec9934c3 100644 --- a/src/main/java/org/cactoos/scalar/Equality.java +++ b/src/main/java/org/cactoos/scalar/Equality.java @@ -70,7 +70,7 @@ public Integer value() throws Exception { () -> { int result = 0; for (int idx = rght.length - 1; idx >= 0; --idx) { - result = lft[idx] - rght[idx]; + result = (int) lft[idx] - (int) rght[idx]; if (result != 0) { break; } diff --git a/src/main/java/org/cactoos/scalar/LengthOf.java b/src/main/java/org/cactoos/scalar/LengthOf.java index 20a218e0d..2fe3d3995 100644 --- a/src/main/java/org/cactoos/scalar/LengthOf.java +++ b/src/main/java/org/cactoos/scalar/LengthOf.java @@ -47,7 +47,7 @@ public final class LengthOf extends ScalarEnvelope { public LengthOf(final Iterable items) { this(() -> { final Iterator iterator = items.iterator(); - long size = 0; + long size = 0L; while (iterator.hasNext()) { iterator.next(); ++size; diff --git a/src/main/java/org/cactoos/text/Abbreviated.java b/src/main/java/org/cactoos/text/Abbreviated.java index f9a1375ea..a9f8f9831 100644 --- a/src/main/java/org/cactoos/text/Abbreviated.java +++ b/src/main/java/org/cactoos/text/Abbreviated.java @@ -89,7 +89,7 @@ public Abbreviated(final Text text, final int max) { new Flattened( new Ternary<>( new ScalarOf<>(() -> new Sticky(text)), - (Text t) -> new LengthOf(t).value() <= max, + (Text t) -> new LengthOf(t).value() <= (long) max, t -> t, t -> new FormattedText( "%s%s", diff --git a/src/main/java/org/cactoos/text/HexOf.java b/src/main/java/org/cactoos/text/HexOf.java index b612687f5..449552af1 100644 --- a/src/main/java/org/cactoos/text/HexOf.java +++ b/src/main/java/org/cactoos/text/HexOf.java @@ -54,7 +54,7 @@ public HexOf(final Bytes bytes) { final char[] hex = new char[bts.length * 2]; int chr = -1; for (final byte byt: bts) { - final int value = 0xff & byt; + final int value = 0xff & (int) byt; hex[++chr] = HexOf.HEX_CHARS[value >>> 4]; hex[++chr] = HexOf.HEX_CHARS[value & 0x0f]; } diff --git a/src/main/java/org/cactoos/text/TextOfString.java b/src/main/java/org/cactoos/text/TextOfString.java index bd6e66fcf..51aceeca2 100644 --- a/src/main/java/org/cactoos/text/TextOfString.java +++ b/src/main/java/org/cactoos/text/TextOfString.java @@ -53,7 +53,7 @@ public TextOfString(final String input) { } @Override - public String asString() throws Exception { + public String asString() { return this.input; } diff --git a/src/main/java/org/cactoos/time/DateOf.java b/src/main/java/org/cactoos/time/DateOf.java index 366fb1474..afa6eabba 100644 --- a/src/main/java/org/cactoos/time/DateOf.java +++ b/src/main/java/org/cactoos/time/DateOf.java @@ -72,7 +72,7 @@ public DateOf(final CharSequence date, final DateTimeFormatter formatter) { date, new DateTimeFormatterBuilder() .append(formatter) - .parseDefaulting(ChronoField.HOUR_OF_DAY, 0) + .parseDefaulting(ChronoField.HOUR_OF_DAY, 0L) .toFormatter() ).toInstant(ZoneOffset.UTC) ) diff --git a/src/test/java/org/cactoos/bytes/EmptyClosableReader.java b/src/test/java/org/cactoos/bytes/EmptyClosableReader.java index 00711082e..c3cdb7ab9 100644 --- a/src/test/java/org/cactoos/bytes/EmptyClosableReader.java +++ b/src/test/java/org/cactoos/bytes/EmptyClosableReader.java @@ -23,7 +23,6 @@ */ package org.cactoos.bytes; -import java.io.IOException; import java.io.Reader; import org.cactoos.io.ReaderOf; @@ -46,13 +45,12 @@ final class EmptyClosableReader extends Reader { private boolean closed; @Override - public int read(final char[] cbuf, final int off, final int len) - throws IOException { + public int read(final char[] cbuf, final int off, final int len) { return -1; } @Override - public void close() throws IOException { + public void close() { this.closed = true; } diff --git a/src/test/java/org/cactoos/bytes/HexOfTest.java b/src/test/java/org/cactoos/bytes/HexOfTest.java index bc9e78619..da912d727 100644 --- a/src/test/java/org/cactoos/bytes/HexOfTest.java +++ b/src/test/java/org/cactoos/bytes/HexOfTest.java @@ -53,7 +53,7 @@ void emptyText() throws Exception { void validHex() throws Exception { final byte[] bytes = new byte[256]; for (int index = 0; index < 256; ++index) { - bytes[index] = (byte) (index + Byte.MIN_VALUE); + bytes[index] = (byte) (index + (int) Byte.MIN_VALUE); } new Assertion<>( "Must convert hexadecimal text to bytes", @@ -67,7 +67,7 @@ void validHex() throws Exception { } @Test - void invalidHexLength() throws Exception { + void invalidHexLength() { new Assertion<>( "Must invalid hex length", () -> new HexOf(new TextOf("ABF")).asBytes(), @@ -79,7 +79,7 @@ void invalidHexLength() throws Exception { } @Test - void invalidHex() throws Exception { + void invalidHex() { new Assertion<>( "Must invalid hex", () -> new HexOf(new TextOf("ABG!")).asBytes(), diff --git a/src/test/java/org/cactoos/bytes/InputAsBytesTest.java b/src/test/java/org/cactoos/bytes/InputAsBytesTest.java index f3f4dd8a1..907ac581e 100644 --- a/src/test/java/org/cactoos/bytes/InputAsBytesTest.java +++ b/src/test/java/org/cactoos/bytes/InputAsBytesTest.java @@ -82,7 +82,7 @@ void readsLargeContent() throws Exception { } @Test - void readsInputIntoBytes() throws Exception { + void readsInputIntoBytes() { new Assertion<>( "must read bytes from Input", new TextOf( @@ -103,7 +103,7 @@ void readsInputIntoBytes() throws Exception { } @Test - void readsInputIntoBytesWithSmallBuffer() throws Exception { + void readsInputIntoBytesWithSmallBuffer() { new Assertion<>( "must read bytes from Input with a small reading buffer", new TextOf( diff --git a/src/test/java/org/cactoos/bytes/ReaderAsBytesTest.java b/src/test/java/org/cactoos/bytes/ReaderAsBytesTest.java index b75d6782c..4f31cb6b3 100644 --- a/src/test/java/org/cactoos/bytes/ReaderAsBytesTest.java +++ b/src/test/java/org/cactoos/bytes/ReaderAsBytesTest.java @@ -39,7 +39,7 @@ final class ReaderAsBytesTest { @Test - void readsString() throws Exception { + void readsString() { final String source = "hello, друг!"; new Assertion<>( "Must read string through a reader", diff --git a/src/test/java/org/cactoos/experimental/ThreadsTest.java b/src/test/java/org/cactoos/experimental/ThreadsTest.java index 1be042212..c91149bda 100644 --- a/src/test/java/org/cactoos/experimental/ThreadsTest.java +++ b/src/test/java/org/cactoos/experimental/ThreadsTest.java @@ -42,7 +42,7 @@ * * @since 1.0.0 */ -@SuppressWarnings("PMD.AvoidDuplicateLiterals") +@SuppressWarnings({ "PMD.AvoidDuplicateLiterals", "PMD.CloseResource" }) final class ThreadsTest { /** @@ -55,14 +55,14 @@ final class ThreadsTest { * {@link ExecutorService} was initiated by someone else. */ @RepeatedTest(ThreadsTest.REPETITIONS) - void containsResults() throws Exception { + void containsResults() { final ExecutorService extor = Executors.newFixedThreadPool(3); try { new Assertion<>( "Must contain results from callables", - new Threads( + new Threads<>( extor, - Duration.ofSeconds(1), + Duration.ofSeconds(1L), () -> { this.sleep(); return "txt 1"; @@ -92,15 +92,15 @@ void containsResults() throws Exception { * {@link ExecutorService} was initiated by someone else. */ @RepeatedTest(ThreadsTest.REPETITIONS) - void failsDueToTimeoutWithExternalExecutorService() throws Exception { + void failsDueToTimeoutWithExternalExecutorService() { final ExecutorService extor = Executors.newFixedThreadPool(2); try { new Assertion<>( "Must fail due to timeout", () -> new LengthOf( - new Threads( + new Threads<>( extor, - Duration.ofMillis(1), + Duration.ofMillis(1L), () -> { this.sleep(); return "txt 1"; @@ -133,9 +133,9 @@ void failsDueToException() { new Assertion<>( "Must rethrow error", () -> new LengthOf( - new Threads( + new Threads<>( extor, - Duration.ofSeconds(1), + Duration.ofSeconds(1L), () -> { this.sleep(); return "txt 1"; @@ -162,12 +162,12 @@ void failsDueToException() { * {@link ExecutorService} was initiated by {@link Threads} itself. */ @RepeatedTest(ThreadsTest.REPETITIONS) - void containsValuesWithInlineExecutorService() throws Exception { + void containsValuesWithInlineExecutorService() { new Assertion<>( "Must contain results from the callables when using inline executor service", - new Threads( + new Threads<>( 3, - Duration.ofSeconds(1), + Duration.ofSeconds(1L), () -> { this.sleep(); return "txt 1"; @@ -190,13 +190,13 @@ void containsValuesWithInlineExecutorService() throws Exception { * {@link ExecutorService} was initiated by {@link Threads} itself. */ @RepeatedTest(ThreadsTest.REPETITIONS) - void failsDueToTimeoutWithInlineExecutorService() throws Exception { + void failsDueToTimeoutWithInlineExecutorService() { new Assertion<>( "Must fail due to timeout", () -> new LengthOf( - new Threads( + new Threads<>( 2, - Duration.ofMillis(1), + Duration.ofMillis(1L), () -> { this.sleep(); return "txt 1"; @@ -220,12 +220,12 @@ void failsDueToTimeoutWithInlineExecutorService() throws Exception { * {@link ExecutorService} was initiated by someone else. */ @RepeatedTest(ThreadsTest.REPETITIONS) - void containsResultsNoTimeout() throws Exception { + void containsResultsNoTimeout() { final ExecutorService extor = Executors.newFixedThreadPool(3); try { new Assertion<>( "Must contain results from the callables without using timeout", - new Threads( + new Threads<>( extor, () -> { this.sleep(); @@ -258,7 +258,7 @@ void failsDueToExceptionNoTimeout() { new Assertion<>( "Must rethrow error", () -> new LengthOf( - new Threads( + new Threads<>( extor, () -> { this.sleep(); @@ -289,7 +289,7 @@ void failsDueToExceptionNoTimeout() { void containsValuesWithInlineExecutorServiceNoTimeout() { new Assertion<>( "Must contain results from the callables when using inline executor without timeout", - new Threads( + new Threads<>( 3, () -> { this.sleep(); diff --git a/src/test/java/org/cactoos/func/AsyncTest.java b/src/test/java/org/cactoos/func/AsyncTest.java index 761865a0c..22f4f8852 100644 --- a/src/test/java/org/cactoos/func/AsyncTest.java +++ b/src/test/java/org/cactoos/func/AsyncTest.java @@ -120,7 +120,7 @@ void runsInBackgroundWithThreadFactory() { new Satisfies<>( future -> { future.get(); - return latch.getCount() == 0; + return latch.getCount() == 0L; } ) ) @@ -153,7 +153,7 @@ void runsInBackgroundWithExecutorService() { new Satisfies<>( future -> { future.get(); - return latch.getCount() == 0; + return latch.getCount() == 0L; } ) ) diff --git a/src/test/java/org/cactoos/func/BiFuncOfTest.java b/src/test/java/org/cactoos/func/BiFuncOfTest.java index e1c788abc..57ae126d3 100644 --- a/src/test/java/org/cactoos/func/BiFuncOfTest.java +++ b/src/test/java/org/cactoos/func/BiFuncOfTest.java @@ -41,7 +41,7 @@ final class BiFuncOfTest { @Test - void convertsFuncIntoBiFunc() throws Exception { + void convertsFuncIntoBiFunc() { new Assertion<>( "Must convert function into bi-function", new BiFuncOf<>( @@ -58,7 +58,7 @@ void convertsFuncIntoBiFunc() throws Exception { } @Test - void convertsProcIntoBiFunc() throws Exception { + void convertsProcIntoBiFunc() { final AtomicReference done = new AtomicReference<>(); final Object result = new Object(); new Assertion<>( @@ -90,7 +90,7 @@ void convertsScalarIntoBiFunc() throws Exception { } @Test - void convertsLambdaIntoBiFunc() throws Exception { + void convertsLambdaIntoBiFunc() { new Assertion<>( "Must convert lambda into bi-function", new BiFuncOf<>((first, second) -> new Object[] {first, second}), diff --git a/src/test/java/org/cactoos/func/ChainedTest.java b/src/test/java/org/cactoos/func/ChainedTest.java index 5d49dc845..e377330c3 100644 --- a/src/test/java/org/cactoos/func/ChainedTest.java +++ b/src/test/java/org/cactoos/func/ChainedTest.java @@ -42,7 +42,7 @@ final class ChainedTest { @Test - void withoutIterable() throws Exception { + void withoutIterable() { new Assertion<>( "Must work without iterable", new LengthOf( @@ -62,7 +62,7 @@ void withoutIterable() throws Exception { } @Test - void withIterable() throws Exception { + void withIterable() { new Assertion<>( "Must work with iterable", new LengthOf( diff --git a/src/test/java/org/cactoos/func/FuncOfTest.java b/src/test/java/org/cactoos/func/FuncOfTest.java index 1a10ef840..34d5b74fc 100644 --- a/src/test/java/org/cactoos/func/FuncOfTest.java +++ b/src/test/java/org/cactoos/func/FuncOfTest.java @@ -38,7 +38,7 @@ @SuppressWarnings("PMD.JUnitTestsShouldIncludeAssert") final class FuncOfTest { @Test - void convertsProcIntoFunc() throws Exception { + void convertsProcIntoFunc() { final AtomicReference done = new AtomicReference<>(); final Object result = new Object(); new Assertion<>( @@ -60,7 +60,7 @@ void convertsProcIntoFunc() throws Exception { } @Test - void convertsScalarIntoFunc() throws Exception { + void convertsScalarIntoFunc() { final Object result = new Object(); new Assertion<>( "Must convert Scalar into Func", @@ -75,7 +75,7 @@ void convertsScalarIntoFunc() throws Exception { } @Test - void convertsLambdaIntoFunc() throws Exception { + void convertsLambdaIntoFunc() { new Assertion<>( "Must convert Lambda into Func", new FuncOf<>(input -> input), diff --git a/src/test/java/org/cactoos/io/FakeInputStream.java b/src/test/java/org/cactoos/io/FakeInputStream.java index deb8618e3..e0fa65abc 100644 --- a/src/test/java/org/cactoos/io/FakeInputStream.java +++ b/src/test/java/org/cactoos/io/FakeInputStream.java @@ -23,7 +23,6 @@ */ package org.cactoos.io; -import java.io.IOException; import java.io.InputStream; import java.util.concurrent.atomic.AtomicBoolean; @@ -47,12 +46,12 @@ final class FakeInputStream extends InputStream { } @Override - public int read() throws IOException { + public int read() { return -1; } @Override - public void close() throws IOException { + public void close() { this.closed.set(true); } diff --git a/src/test/java/org/cactoos/io/FakeOutputStream.java b/src/test/java/org/cactoos/io/FakeOutputStream.java index 14f691faa..b4f5d9851 100644 --- a/src/test/java/org/cactoos/io/FakeOutputStream.java +++ b/src/test/java/org/cactoos/io/FakeOutputStream.java @@ -23,7 +23,6 @@ */ package org.cactoos.io; -import java.io.IOException; import java.io.OutputStream; import java.util.concurrent.atomic.AtomicBoolean; @@ -49,11 +48,11 @@ final class FakeOutputStream extends OutputStream { @Override @SuppressWarnings("PMD.UncommentedEmptyMethodBody") // @checkstyle ParameterNameCheck (1 lines) - public void write(final int b) throws IOException { + public void write(final int b) { } @Override - public void close() throws IOException { + public void close() { this.closed.set(true); } diff --git a/src/test/java/org/cactoos/io/HeadOfTest.java b/src/test/java/org/cactoos/io/HeadOfTest.java index e9904ae91..6a9499ccb 100644 --- a/src/test/java/org/cactoos/io/HeadOfTest.java +++ b/src/test/java/org/cactoos/io/HeadOfTest.java @@ -38,7 +38,7 @@ final class HeadOfTest { @Test - void readsHeadOfLongerInput() throws Exception { + void readsHeadOfLongerInput() { new Assertion<>( "must limit exactly the number of read bytes", new TextOf( @@ -52,7 +52,7 @@ void readsHeadOfLongerInput() throws Exception { } @Test - void readsEmptyHeadOfInput() throws Exception { + void readsEmptyHeadOfInput() { new Assertion<>( "must limit to 0 the number of read bytes", new TextOf( @@ -66,7 +66,7 @@ void readsEmptyHeadOfInput() throws Exception { } @Test - void readsHeadOfShorterInput() throws Exception { + void readsHeadOfShorterInput() { final String input = "readsHeadOfShorterInput"; new Assertion<>( "must limit to at most the number of available bytes", diff --git a/src/test/java/org/cactoos/io/InputOfTest.java b/src/test/java/org/cactoos/io/InputOfTest.java index e6fa4bcec..c5bba9b72 100644 --- a/src/test/java/org/cactoos/io/InputOfTest.java +++ b/src/test/java/org/cactoos/io/InputOfTest.java @@ -163,7 +163,7 @@ void readsStringUrl() throws IOException, URISyntaxException { } @Test - void readsStringIntoBytes() throws Exception { + void readsStringIntoBytes() { new Assertion<>( "must read bytes from Input", new TextOf( @@ -180,7 +180,7 @@ void readsStringIntoBytes() throws Exception { } @Test - void readsStringBuilder() throws Exception { + void readsStringBuilder() { final String starts = "Name it, "; final String ends = "then it exists!"; new Assertion<>( @@ -201,7 +201,7 @@ void readsStringBuilder() throws Exception { } @Test - void readsStringBuffer() throws Exception { + void readsStringBuffer() { final String starts = "The future "; final String ends = "is now!"; new Assertion<>( @@ -222,7 +222,7 @@ void readsStringBuffer() throws Exception { } @Test - void readsArrayOfChars() throws Exception { + void readsArrayOfChars() { new Assertion<>( "must read array of chars.", new TextOf( @@ -241,7 +241,7 @@ void readsArrayOfChars() throws Exception { } @Test - void readsEncodedArrayOfChars() throws Exception { + void readsEncodedArrayOfChars() { new Assertion<>( "must read array of encoded chars.", new TextOf( @@ -264,7 +264,7 @@ void readsEncodedArrayOfChars() throws Exception { } @Test - void readsStringFromReader() throws Exception { + void readsStringFromReader() { final String source = "hello, source!"; new Assertion<>( "must read string through a reader", @@ -278,7 +278,7 @@ void readsStringFromReader() throws Exception { } @Test - void readsEncodedStringFromReader() throws Exception { + void readsEncodedStringFromReader() { final String source = "hello, друг!"; new Assertion<>( "must read encoded string through a reader", diff --git a/src/test/java/org/cactoos/io/LoggingInputTest.java b/src/test/java/org/cactoos/io/LoggingInputTest.java index 560de96a6..7ad064a81 100644 --- a/src/test/java/org/cactoos/io/LoggingInputTest.java +++ b/src/test/java/org/cactoos/io/LoggingInputTest.java @@ -152,7 +152,7 @@ void logSkipFromLargeTextFile() throws Exception { new ResourceOf("org/cactoos/large-text.txt"), "text file", logger - ).stream().skip(100); + ).stream().skip(100L); new Assertion<>( "Must log skip from text file", new TextOf(logger.toString()), diff --git a/src/test/java/org/cactoos/io/OutputStreamToTest.java b/src/test/java/org/cactoos/io/OutputStreamToTest.java index 284ec199d..08a19bd35 100644 --- a/src/test/java/org/cactoos/io/OutputStreamToTest.java +++ b/src/test/java/org/cactoos/io/OutputStreamToTest.java @@ -23,7 +23,6 @@ */ package org.cactoos.io; -import java.io.IOException; import java.nio.file.Path; import org.cactoos.text.TextOf; import org.junit.jupiter.api.Test; @@ -41,7 +40,7 @@ final class OutputStreamToTest { @Test - void writesLargeContentToFile(@TempDir final Path wdir) throws IOException { + void writesLargeContentToFile(@TempDir final Path wdir) { final Path temp = wdir.resolve("cactoos-1.txt-1"); new Assertion<>( "Must copy Input to Output and return Input", diff --git a/src/test/java/org/cactoos/io/ReaderOfTest.java b/src/test/java/org/cactoos/io/ReaderOfTest.java index a10ca0c5c..f1cbbed46 100644 --- a/src/test/java/org/cactoos/io/ReaderOfTest.java +++ b/src/test/java/org/cactoos/io/ReaderOfTest.java @@ -54,7 +54,7 @@ void readsEmpty() { } @Test - void readsCharVarArg() throws Exception { + void readsCharVarArg() { new Assertion<>( "Must read chars var args", new TextOf(new ReaderOf('a', 'b', 'c')), @@ -63,7 +63,7 @@ void readsCharVarArg() throws Exception { } @Test - void readsCharArrayWithCharset() throws Exception { + void readsCharArrayWithCharset() { final String message = "char array on äÄ üÜ öÖ ß жш"; new Assertion<>( @@ -79,7 +79,7 @@ void readsCharArrayWithCharset() throws Exception { } @Test - void readsCharArrayWithCharsetByName() throws Exception { + void readsCharArrayWithCharsetByName() { final String message = "char array with charset on äÄ üÜ öÖ ß жш"; new Assertion<>( @@ -95,7 +95,7 @@ void readsCharArrayWithCharsetByName() throws Exception { } @Test - void readsByteArray() throws Exception { + void readsByteArray() { final String message = "byte array on äÄ üÜ öÖ ß жш"; new Assertion<>( @@ -110,7 +110,7 @@ void readsByteArray() throws Exception { } @Test - void readsByteArrayWithCharset() throws Exception { + void readsByteArrayWithCharset() { final String message = "byte array with charset on äÄ üÜ öÖ ß жш"; new Assertion<>( @@ -126,7 +126,7 @@ void readsByteArrayWithCharset() throws Exception { } @Test - void readsByteArrayWithCharsetByName() throws Exception { + void readsByteArrayWithCharsetByName() { final String message = "bte array with charset by name on äÄ üÜ öÖ ß жш"; new Assertion<>( @@ -212,7 +212,7 @@ void readsUri(@TempDir final Path wdir) throws Exception { } @Test - void readsBytes() throws Exception { + void readsBytes() { final String input = "Bytes on äÄ üÜ öÖ ß жш"; new Assertion<>( @@ -223,7 +223,7 @@ void readsBytes() throws Exception { } @Test - void readsText() throws Exception { + void readsText() { final String input = "Text on äÄ üÜ öÖ ß жш"; new Assertion<>( @@ -234,7 +234,7 @@ void readsText() throws Exception { } @Test - void readsTextWithCharset() throws Exception { + void readsTextWithCharset() { final String input = "Text with charset on äÄ üÜ öÖ ß жш"; new Assertion<>( @@ -250,7 +250,7 @@ void readsTextWithCharset() throws Exception { } @Test - void readsTextWithCharsetByName() throws Exception { + void readsTextWithCharsetByName() { final String input = "Text with charset by name on äÄ üÜ öÖ ß жш"; new Assertion<>( @@ -266,7 +266,7 @@ void readsTextWithCharsetByName() throws Exception { } @Test - void readsCharSequence() throws Exception { + void readsCharSequence() { final String input = "char sequence on äÄ üÜ öÖ ß жш"; new Assertion<>( @@ -277,7 +277,7 @@ void readsCharSequence() throws Exception { } @Test - void readsCharSequenceWithCharset() throws Exception { + void readsCharSequenceWithCharset() { final String input = "char sequence with charset on äÄ üÜ öÖ ß жш"; new Assertion<>( @@ -293,7 +293,7 @@ void readsCharSequenceWithCharset() throws Exception { } @Test - void readsCharSequenceWithCharsetByName() throws Exception { + void readsCharSequenceWithCharsetByName() { final String input = "char sequence with charset by name on äÄ üÜ öÖ ß жш"; new Assertion<>( @@ -309,7 +309,7 @@ void readsCharSequenceWithCharsetByName() throws Exception { } @Test - void readsInput() throws Exception { + void readsInput() { final String input = "Input on äÄ üÜ öÖ ß жш"; new Assertion<>( @@ -320,7 +320,7 @@ void readsInput() throws Exception { } @Test - void readsInputWithCharset() throws Exception { + void readsInputWithCharset() { final String input = "Input with charset on äÄ üÜ öÖ ß жш"; new Assertion<>( @@ -336,7 +336,7 @@ void readsInputWithCharset() throws Exception { } @Test - void readsInputWithCharsetByName() throws Exception { + void readsInputWithCharsetByName() { final String input = "Input with charset by name on äÄ üÜ öÖ ß жш"; new Assertion<>( @@ -352,7 +352,7 @@ void readsInputWithCharsetByName() throws Exception { } @Test - void readsInputWithCharsetDecoder() throws Exception { + void readsInputWithCharsetDecoder() { final String input = "Input with charset decoder on äÄ üÜ öÖ ß жш"; new Assertion<>( @@ -368,7 +368,7 @@ void readsInputWithCharsetDecoder() throws Exception { } @Test - void readsInputStream() throws Exception { + void readsInputStream() { final String input = "InputStream on äÄ üÜ öÖ ß жш"; new Assertion<>( @@ -379,7 +379,7 @@ void readsInputStream() throws Exception { } @Test - void readsInputStreamWithCharset() throws Exception { + void readsInputStreamWithCharset() { final String input = "InputStream with charset on äÄ üÜ öÖ ß жш"; new Assertion<>( @@ -411,7 +411,7 @@ void readsInputStreamWithCharsetByName() throws Exception { } @Test - void readsInputStreamWithCharsetDecoder() throws Exception { + void readsInputStreamWithCharsetDecoder() { final String input = "InputStream with charset decoder on äÄ üÜ öÖ ß жш"; new Assertion<>( diff --git a/src/test/java/org/cactoos/io/ResourceOfTest.java b/src/test/java/org/cactoos/io/ResourceOfTest.java index b5896e960..e65325c40 100644 --- a/src/test/java/org/cactoos/io/ResourceOfTest.java +++ b/src/test/java/org/cactoos/io/ResourceOfTest.java @@ -67,7 +67,7 @@ void readsBinaryResource() throws Exception { } @Test - void readsTextResource() throws Exception { + void readsTextResource() { new Assertion<>( "Must read a text resource from classpath", ResourceOfTest.large(), @@ -76,7 +76,7 @@ void readsTextResource() throws Exception { } @Test - void readsTextResourceThroughClassloader() throws Exception { + void readsTextResourceThroughClassloader() { new Assertion<>( "Must read a text resource from classloader", ResourceOfTest.large(), @@ -85,7 +85,7 @@ void readsTextResourceThroughClassloader() throws Exception { } @Test - void readAbsentResourceTest() throws Exception { + void readAbsentResourceTest() { new Assertion<>( "Can't replace an absent resource with a text", new TextOf( @@ -114,7 +114,7 @@ void throwsWhenResourceIsAbsent() { } @Test - void acceptsTextAsResourceName() throws Exception { + void acceptsTextAsResourceName() { new Assertion<>( "Can't accept Text as resource name", new TextOf( @@ -127,7 +127,7 @@ void acceptsTextAsResourceName() throws Exception { } @Test - void acceptsTextsAsResourceNameAndFallback() throws Exception { + void acceptsTextsAsResourceNameAndFallback() { new Assertion<>( "Can't use Texts as parameters", new TextOf( diff --git a/src/test/java/org/cactoos/io/SlowInputTest.java b/src/test/java/org/cactoos/io/SlowInputTest.java index 206d1d5da..cdf70878a 100644 --- a/src/test/java/org/cactoos/io/SlowInputTest.java +++ b/src/test/java/org/cactoos/io/SlowInputTest.java @@ -40,7 +40,7 @@ final class SlowInputTest { @Test - void calculatesLength() throws Exception { + void calculatesLength() { final String text = "What's up, друг?"; new Assertion<>( "Can't calculate the length of Input", @@ -56,7 +56,7 @@ void calculatesLength() throws Exception { } @Test - void readsFileContentSlowly() throws Exception { + void readsFileContentSlowly() { final long size = 100_000L; new Assertion<>( "Can't calculate length if the input is slow", diff --git a/src/test/java/org/cactoos/io/TailOfTest.java b/src/test/java/org/cactoos/io/TailOfTest.java index 883d48aa1..86349c6e1 100644 --- a/src/test/java/org/cactoos/io/TailOfTest.java +++ b/src/test/java/org/cactoos/io/TailOfTest.java @@ -124,7 +124,7 @@ void tailsOnStreamLongerThanBufferAndBytes() throws Exception { } @Test - void failsIfBufferSizeSmallerThanTailSize() throws Exception { + void failsIfBufferSizeSmallerThanTailSize() { final int size = 4; new Assertion<>( "Can't read in smaller buffer", diff --git a/src/test/java/org/cactoos/iterable/CycledTest.java b/src/test/java/org/cactoos/iterable/CycledTest.java index 465764130..ac978ccd8 100644 --- a/src/test/java/org/cactoos/iterable/CycledTest.java +++ b/src/test/java/org/cactoos/iterable/CycledTest.java @@ -56,7 +56,7 @@ void repeatIterableTest() { } @Test - void notCycledEmptyTest() throws Exception { + void notCycledEmptyTest() { new Assertion<>( "Must generate an empty iterable", new LengthOf( diff --git a/src/test/java/org/cactoos/iterable/FilteredTest.java b/src/test/java/org/cactoos/iterable/FilteredTest.java index 6c76326be..306548b63 100644 --- a/src/test/java/org/cactoos/iterable/FilteredTest.java +++ b/src/test/java/org/cactoos/iterable/FilteredTest.java @@ -42,7 +42,7 @@ final class FilteredTest { @Test - void filtersList() throws Exception { + void filtersList() { new Assertion<>( "Must calculate the length of an iterable", new LengthOf( @@ -58,7 +58,7 @@ void filtersList() throws Exception { } @Test - void filtersEmptyList() throws Exception { + void filtersEmptyList() { new Assertion<>( "Must calculate the length of an empty iterable", new LengthOf( @@ -154,7 +154,7 @@ void filterWithNumberFilter() { new Assertion<>( "Must be filtered with super type filter", new Filtered<>( - (Number d) -> d.doubleValue() > 0, + (Number d) -> d.doubleValue() > (double) 0, new IterableOf<>(1d, -2d, 3d) ), new HasValues<>(1d, 3d) diff --git a/src/test/java/org/cactoos/iterable/HeadOfTest.java b/src/test/java/org/cactoos/iterable/HeadOfTest.java index 74268ff77..2f7a0bf81 100644 --- a/src/test/java/org/cactoos/iterable/HeadOfTest.java +++ b/src/test/java/org/cactoos/iterable/HeadOfTest.java @@ -36,7 +36,7 @@ final class HeadOfTest { @Test @SuppressWarnings("PMD.AvoidDuplicateLiterals") - void headIterable() throws Exception { + void headIterable() { MatcherAssert.assertThat( "Must skip elements in iterable", new HeadOf<>( diff --git a/src/test/java/org/cactoos/iterable/IterableOfDoublesTest.java b/src/test/java/org/cactoos/iterable/IterableOfDoublesTest.java index 6019313a1..160aa84c5 100644 --- a/src/test/java/org/cactoos/iterable/IterableOfDoublesTest.java +++ b/src/test/java/org/cactoos/iterable/IterableOfDoublesTest.java @@ -37,7 +37,7 @@ final class IterableOfDoublesTest { @Test void convertsDoubleValuesToIterable() { - final double[] values = {1, 2, 3}; + final double[] values = {1.0, 2.0, 3.0}; new Assertion<>( "Must convert double values to iterable", new IterableOfDoubles(values), diff --git a/src/test/java/org/cactoos/iterable/IterableOfFloatsTest.java b/src/test/java/org/cactoos/iterable/IterableOfFloatsTest.java index 77d5effde..36d3adb58 100644 --- a/src/test/java/org/cactoos/iterable/IterableOfFloatsTest.java +++ b/src/test/java/org/cactoos/iterable/IterableOfFloatsTest.java @@ -37,7 +37,7 @@ final class IterableOfFloatsTest { @Test void convertsFloatValuesToIterable() { - final float[] values = {1, 2, 3}; + final float[] values = {1.0F, 2.0F, 3.0F}; new Assertion<>( "Must convert float values to iterable", new IterableOfFloats(values), diff --git a/src/test/java/org/cactoos/iterable/IterableOfLongsTest.java b/src/test/java/org/cactoos/iterable/IterableOfLongsTest.java index 3134817bc..feedc43f4 100644 --- a/src/test/java/org/cactoos/iterable/IterableOfLongsTest.java +++ b/src/test/java/org/cactoos/iterable/IterableOfLongsTest.java @@ -37,7 +37,7 @@ final class IterableOfLongsTest { @Test void convertsLongValuesToIterable() { - final long[] values = {1, 2, 3}; + final long[] values = {1L, 2L, 3L}; new Assertion<>( "Must convert long values to iterable", new IterableOfLongs(values), diff --git a/src/test/java/org/cactoos/iterable/IterableOfShortsTest.java b/src/test/java/org/cactoos/iterable/IterableOfShortsTest.java index 570474e55..efffc2380 100644 --- a/src/test/java/org/cactoos/iterable/IterableOfShortsTest.java +++ b/src/test/java/org/cactoos/iterable/IterableOfShortsTest.java @@ -37,7 +37,7 @@ final class IterableOfShortsTest { @Test @SuppressWarnings("PMD.AvoidUsingShortType") void convertsShortValuesToIterable() { - final short[] values = {1, 2, 3}; + final short[] values = {(short) 1, (short) 2, (short) 3}; new Assertion<>( "Must convert short values to iterable", new IterableOfShorts(values), diff --git a/src/test/java/org/cactoos/iterable/IterableOfTest.java b/src/test/java/org/cactoos/iterable/IterableOfTest.java index 17e12eb9b..54242f153 100644 --- a/src/test/java/org/cactoos/iterable/IterableOfTest.java +++ b/src/test/java/org/cactoos/iterable/IterableOfTest.java @@ -42,7 +42,7 @@ final class IterableOfTest { @Test - void convertsScalarsToIterable() throws Exception { + void convertsScalarsToIterable() { new Assertion<>( "Must convert scalars to iterable", new LengthOf( @@ -64,7 +64,7 @@ void convertsArrayOfIntsToIterable() { } @Test - void convertsObjectsToIterable() throws Exception { + void convertsObjectsToIterable() { new Assertion<>( "Must convert objects to iterable", new LengthOf( diff --git a/src/test/java/org/cactoos/iterable/MappedTest.java b/src/test/java/org/cactoos/iterable/MappedTest.java index 4bed816f5..446471991 100644 --- a/src/test/java/org/cactoos/iterable/MappedTest.java +++ b/src/test/java/org/cactoos/iterable/MappedTest.java @@ -41,7 +41,7 @@ final class MappedTest { @Test - void transformsList() throws Exception { + void transformsList() { new Assertion<>( "Must transform an iterable", new Mapped<>( diff --git a/src/test/java/org/cactoos/iterable/MappedWithIndexTest.java b/src/test/java/org/cactoos/iterable/MappedWithIndexTest.java index 6d0746b5c..f08bf3488 100644 --- a/src/test/java/org/cactoos/iterable/MappedWithIndexTest.java +++ b/src/test/java/org/cactoos/iterable/MappedWithIndexTest.java @@ -36,7 +36,7 @@ */ final class MappedWithIndexTest { @Test - void transformsIterable() throws Exception { + void transformsIterable() { new Assertion<>( "must transform an iterable", new MappedWithIndex<>( diff --git a/src/test/java/org/cactoos/iterable/MatchedTest.java b/src/test/java/org/cactoos/iterable/MatchedTest.java index 443030150..e508c12b7 100644 --- a/src/test/java/org/cactoos/iterable/MatchedTest.java +++ b/src/test/java/org/cactoos/iterable/MatchedTest.java @@ -116,7 +116,7 @@ void matchedAsNumbers() { } @Test - void noCorrelation() throws Exception { + void noCorrelation() { new Assertion<>( "Should fail if there is no correlation", () -> new LengthOf( @@ -131,7 +131,7 @@ void noCorrelation() throws Exception { } @Test - void nonNullCorrelation() throws Exception { + void nonNullCorrelation() { new Assertion<>( "Should fail if parameter is null", () -> new LengthOf( diff --git a/src/test/java/org/cactoos/iterable/PartitionedTest.java b/src/test/java/org/cactoos/iterable/PartitionedTest.java index ea7857e9a..aa66360b2 100644 --- a/src/test/java/org/cactoos/iterable/PartitionedTest.java +++ b/src/test/java/org/cactoos/iterable/PartitionedTest.java @@ -37,7 +37,7 @@ final class PartitionedTest { @Test - void partitionedEmpty() throws Exception { + void partitionedEmpty() { new Assertion<>( "Must generate a Partitioned without values.", new LengthOf( @@ -48,7 +48,7 @@ void partitionedEmpty() throws Exception { } @Test - void partitionedWithPartial() throws Exception { + void partitionedWithPartial() { new Assertion<>( "Must generate a Partitioned with partition size.", new LengthOf( diff --git a/src/test/java/org/cactoos/iterable/RangeOfTest.java b/src/test/java/org/cactoos/iterable/RangeOfTest.java index d8614903a..4da122c8a 100644 --- a/src/test/java/org/cactoos/iterable/RangeOfTest.java +++ b/src/test/java/org/cactoos/iterable/RangeOfTest.java @@ -85,7 +85,7 @@ void testLongRange() { new Assertion<>( "Must generate a range of long", new ListOf<>( - new RangeOf<>(1L, 5L, value -> value + 1) + new RangeOf<>(1L, 5L, value -> value + 1L) ), Matchers.contains(1L, 2L, 3L, 4L, 5L) ).affirm(); @@ -110,7 +110,7 @@ void testLocalDateRange() { new RangeOf<>( LocalDate.of(2017, 1, 1), LocalDate.of(2017, 1, 3), - value -> value.plus(1, ChronoUnit.DAYS) + value -> value.plus(1L, ChronoUnit.DAYS) ) ), Matchers.contains( diff --git a/src/test/java/org/cactoos/iterable/RepeatedTest.java b/src/test/java/org/cactoos/iterable/RepeatedTest.java index c8e36df8a..0b269ef9b 100644 --- a/src/test/java/org/cactoos/iterable/RepeatedTest.java +++ b/src/test/java/org/cactoos/iterable/RepeatedTest.java @@ -38,7 +38,7 @@ final class RepeatedTest { @Test - void allSameTest() throws Exception { + void allSameTest() { final int size = 42; final int element = 11; MatcherAssert.assertThat( @@ -54,7 +54,7 @@ void allSameTest() throws Exception { } @Test - void emptyTest() throws Exception { + void emptyTest() { MatcherAssert.assertThat( "Can't generate an empty iterable", new LengthOf(new Repeated<>(0, 0)), @@ -63,7 +63,7 @@ void emptyTest() throws Exception { } @Test - void repeatsIntegerTwice() throws Exception { + void repeatsIntegerTwice() { final Iterable list = new Repeated<>(5, 1); MatcherAssert.assertThat( "Can't repeat an integer", diff --git a/src/test/java/org/cactoos/iterable/ShuffledTest.java b/src/test/java/org/cactoos/iterable/ShuffledTest.java index 52184b6df..fb1f38802 100644 --- a/src/test/java/org/cactoos/iterable/ShuffledTest.java +++ b/src/test/java/org/cactoos/iterable/ShuffledTest.java @@ -39,7 +39,7 @@ final class ShuffledTest { @Test - void shuffleArray() throws Exception { + void shuffleArray() { new Assertion<>( "Must shuffle an iterable", new Shuffled<>( diff --git a/src/test/java/org/cactoos/iterable/SlicedTest.java b/src/test/java/org/cactoos/iterable/SlicedTest.java index 81aa8942e..5c6fdaeb0 100644 --- a/src/test/java/org/cactoos/iterable/SlicedTest.java +++ b/src/test/java/org/cactoos/iterable/SlicedTest.java @@ -36,7 +36,7 @@ final class SlicedTest { @Test @SuppressWarnings("PMD.AvoidDuplicateLiterals") - void sliceIterable() throws Exception { + void sliceIterable() { new Assertion<>( "Must get sliced iterable of elements", new Sliced<>( diff --git a/src/test/java/org/cactoos/iterable/SortedTest.java b/src/test/java/org/cactoos/iterable/SortedTest.java index c0b4492fe..9f1024d0b 100644 --- a/src/test/java/org/cactoos/iterable/SortedTest.java +++ b/src/test/java/org/cactoos/iterable/SortedTest.java @@ -40,7 +40,7 @@ final class SortedTest { @Test - void sortsAnArray() throws Exception { + void sortsAnArray() { new Assertion<>( "Can't sort an iterable", new Sorted<>( @@ -54,7 +54,7 @@ void sortsAnArray() throws Exception { @Test @SuppressWarnings("PMD.AvoidDuplicateLiterals") - void sortsAnArrayWithComparator() throws Exception { + void sortsAnArrayWithComparator() { new Assertion<>( "Can't sort an iterable with a comparator", new Sorted<>( @@ -67,7 +67,7 @@ void sortsAnArrayWithComparator() throws Exception { } @Test - void sortsAnEmptyArray() throws Exception { + void sortsAnEmptyArray() { new Assertion<>( "Can't sort an empty iterable", new Sorted( @@ -91,7 +91,7 @@ void sortsCollection() { } @Test - void sortsByNymberComprator() throws Exception { + void sortsByNymberComprator() { new Assertion<>( "Must sort an iterable of numbers", new Sorted<>( diff --git a/src/test/java/org/cactoos/iterable/TailOfTest.java b/src/test/java/org/cactoos/iterable/TailOfTest.java index ce51fed24..725281406 100644 --- a/src/test/java/org/cactoos/iterable/TailOfTest.java +++ b/src/test/java/org/cactoos/iterable/TailOfTest.java @@ -36,7 +36,7 @@ final class TailOfTest { @Test @SuppressWarnings("PMD.AvoidDuplicateLiterals") - void tailIterable() throws Exception { + void tailIterable() { MatcherAssert.assertThat( "Can't get tail portion of iterable", new TailOf<>( diff --git a/src/test/java/org/cactoos/iterator/IteratorOfBytesTest.java b/src/test/java/org/cactoos/iterator/IteratorOfBytesTest.java index cbf420180..6c33c03d9 100644 --- a/src/test/java/org/cactoos/iterator/IteratorOfBytesTest.java +++ b/src/test/java/org/cactoos/iterator/IteratorOfBytesTest.java @@ -45,7 +45,7 @@ final class IteratorOfBytesTest { @Test - void canBeConstructedFromString() throws Exception { + void canBeConstructedFromString() { final Iterator itr = new IteratorOfBytes( "F" ); @@ -62,7 +62,7 @@ void canBeConstructedFromString() throws Exception { } @Test - void canBeConstructedFromText() throws Exception { + void canBeConstructedFromText() { final Iterator itr = new IteratorOfBytes( new TextOf("ABC") ); diff --git a/src/test/java/org/cactoos/iterator/IteratorOfLongsTest.java b/src/test/java/org/cactoos/iterator/IteratorOfLongsTest.java index aa1e4e182..4482971e5 100644 --- a/src/test/java/org/cactoos/iterator/IteratorOfLongsTest.java +++ b/src/test/java/org/cactoos/iterator/IteratorOfLongsTest.java @@ -58,7 +58,7 @@ void emptyIteratorThrowsException() { @Test void nonEmptyIteratorDoesNotHaveNext() { - final IteratorOfLongs iterator = new IteratorOfLongs(1, 2); + final IteratorOfLongs iterator = new IteratorOfLongs(1L, 2L); iterator.next(); iterator.next(); new Assertion<>( @@ -70,7 +70,7 @@ void nonEmptyIteratorDoesNotHaveNext() { @Test void nonEmptyIteratorThrowsException() { - final IteratorOfLongs iterator = new IteratorOfLongs(1); + final IteratorOfLongs iterator = new IteratorOfLongs(1L); iterator.next(); new Assertion<>( "Exception is expected for fully traversed iterator.", diff --git a/src/test/java/org/cactoos/iterator/PartitionedTest.java b/src/test/java/org/cactoos/iterator/PartitionedTest.java index 1539ce2dc..65f969d40 100644 --- a/src/test/java/org/cactoos/iterator/PartitionedTest.java +++ b/src/test/java/org/cactoos/iterator/PartitionedTest.java @@ -46,7 +46,7 @@ final class PartitionedTest { @Test - void emptyPartitioned() throws Exception { + void emptyPartitioned() { new Assertion<>( "Can't generate an empty Partitioned.", new LengthOf( diff --git a/src/test/java/org/cactoos/iterator/RangeOfTest.java b/src/test/java/org/cactoos/iterator/RangeOfTest.java index b81df87d6..9af7c03f4 100644 --- a/src/test/java/org/cactoos/iterator/RangeOfTest.java +++ b/src/test/java/org/cactoos/iterator/RangeOfTest.java @@ -74,7 +74,7 @@ void testLongRange() { new Assertion<>( "Must generate a range of long", new ListOf<>( - new RangeOf<>(1L, 5L, value -> value + 1) + new RangeOf<>(1L, 5L, value -> value + 1L) ), new HasValues<>(1L, 2L, 3L, 4L, 5L) ).affirm(); @@ -99,7 +99,7 @@ void testLocalDateRange() { new RangeOf<>( LocalDate.of(2017, 1, 1), LocalDate.of(2017, 1, 3), - value -> value.plus(1, ChronoUnit.DAYS) + value -> value.plus(1L, ChronoUnit.DAYS) ) ), new HasValues<>( diff --git a/src/test/java/org/cactoos/list/JoinedTest.java b/src/test/java/org/cactoos/list/JoinedTest.java index d438c23c0..a9aa787ce 100644 --- a/src/test/java/org/cactoos/list/JoinedTest.java +++ b/src/test/java/org/cactoos/list/JoinedTest.java @@ -453,8 +453,8 @@ void infersCorrectly() { new Joined<>( Integer.valueOf(1), new ListOf<>( - Double.valueOf(2), - Double.valueOf(3) + Double.valueOf(2.0), + Double.valueOf(3.0) ) ), new IsIterableContainingInOrder<>( diff --git a/src/test/java/org/cactoos/list/ListOfTest.java b/src/test/java/org/cactoos/list/ListOfTest.java index b92318fa6..62f9441ac 100644 --- a/src/test/java/org/cactoos/list/ListOfTest.java +++ b/src/test/java/org/cactoos/list/ListOfTest.java @@ -46,7 +46,7 @@ final class ListOfTest { @Test - void behavesAsCollection() throws Exception { + void behavesAsCollection() { MatcherAssert.assertThat( "Can't behave as a list", new ListOf<>(1, 2), @@ -55,7 +55,7 @@ void behavesAsCollection() throws Exception { } @Test - void elementAtIndexTest() throws Exception { + void elementAtIndexTest() { final int num = 345; MatcherAssert.assertThat( "Can't convert an iterable to a list", @@ -65,7 +65,7 @@ void elementAtIndexTest() throws Exception { } @Test - void sizeTest() throws Exception { + void sizeTest() { final int size = 42; MatcherAssert.assertThat( "Can't build a list with a certain size", @@ -77,7 +77,7 @@ void sizeTest() throws Exception { } @Test - void emptyTest() throws Exception { + void emptyTest() { MatcherAssert.assertThat( "Can't convert an empty iterable to an empty list", new ListOf<>( @@ -106,7 +106,7 @@ void highBoundTest() { } @Test - void makesListFromMappedIterable() throws Exception { + void makesListFromMappedIterable() { final List list = new ListOf<>( new Mapped<>( i -> i + 1, diff --git a/src/test/java/org/cactoos/map/GroupedTest.java b/src/test/java/org/cactoos/map/GroupedTest.java index 8ea3b3cbf..b2c9d58b2 100644 --- a/src/test/java/org/cactoos/map/GroupedTest.java +++ b/src/test/java/org/cactoos/map/GroupedTest.java @@ -41,7 +41,7 @@ final class GroupedTest { @Test - void groupedByNumber() throws Exception { + void groupedByNumber() { new Assertion<>( "Can't behave as a map", new Grouped<>( @@ -54,7 +54,7 @@ void groupedByNumber() throws Exception { } @Test - void emptyIterable() throws Exception { + void emptyIterable() { new Assertion<>( "Can't build grouped by empty iterable", new Grouped<>( @@ -67,7 +67,7 @@ void emptyIterable() throws Exception { } @Test - void groupedByOneHasEntries() throws Exception { + void groupedByOneHasEntries() { new Assertion<>( "Can't group int values", new Grouped<>( @@ -83,7 +83,7 @@ void groupedByOneHasEntries() throws Exception { } @Test - void groupedBySuperType() throws Exception { + void groupedBySuperType() { new Assertion<>( "Must group Number values", new Grouped<>( diff --git a/src/test/java/org/cactoos/number/NumberEnvelopeTest.java b/src/test/java/org/cactoos/number/NumberEnvelopeTest.java index 7556298f5..fffd0489d 100644 --- a/src/test/java/org/cactoos/number/NumberEnvelopeTest.java +++ b/src/test/java/org/cactoos/number/NumberEnvelopeTest.java @@ -23,7 +23,6 @@ */ package org.cactoos.number; -import java.io.IOException; import java.util.stream.Stream; import org.hamcrest.core.IsEqual; import org.hamcrest.core.IsNot; @@ -57,7 +56,7 @@ public Stream provideArguments(final ExtensionContext ctx) { @ParameterizedTest @ArgumentsSource(NumberEnvelopeTest.class) - void floatValue(final Number nbr) throws IOException { + void floatValue(final Number nbr) { new Assertion<>( "Must forward floatValue", new NumberEnvelope(nbr) { }.floatValue(), @@ -67,7 +66,7 @@ void floatValue(final Number nbr) throws IOException { @ParameterizedTest @ArgumentsSource(NumberEnvelopeTest.class) - void intValue(final Number nbr) throws IOException { + void intValue(final Number nbr) { new Assertion<>( "Must forward intValue", new NumberEnvelope(nbr) { }.intValue(), @@ -77,7 +76,7 @@ void intValue(final Number nbr) throws IOException { @ParameterizedTest @ArgumentsSource(NumberEnvelopeTest.class) - void doubleValue(final Number nbr) throws IOException { + void doubleValue(final Number nbr) { new Assertion<>( "Must forward doubleValue", new NumberEnvelope(nbr) { }.doubleValue(), @@ -87,7 +86,7 @@ void doubleValue(final Number nbr) throws IOException { @ParameterizedTest @ArgumentsSource(NumberEnvelopeTest.class) - void longValue(final Number nbr) throws IOException { + void longValue(final Number nbr) { new Assertion<>( "Must forward longValue", new NumberEnvelope(nbr) { }.longValue(), @@ -97,7 +96,7 @@ void longValue(final Number nbr) throws IOException { @ParameterizedTest @ArgumentsSource(NumberEnvelopeTest.class) - void byteValue(final Number nbr) throws IOException { + void byteValue(final Number nbr) { new Assertion<>( "Must forward byteValue", new NumberEnvelope(nbr) { }.byteValue(), @@ -107,7 +106,7 @@ void byteValue(final Number nbr) throws IOException { @ParameterizedTest @ArgumentsSource(NumberEnvelopeTest.class) - void shortValue(final Number nbr) throws IOException { + void shortValue(final Number nbr) { new Assertion<>( "Must forward shortValue", new NumberEnvelope(nbr) { }.shortValue(), @@ -117,7 +116,7 @@ void shortValue(final Number nbr) throws IOException { @ParameterizedTest @ArgumentsSource(NumberEnvelopeTest.class) - void hashCode(final Number nbr) throws IOException { + void hashCode(final Number nbr) { new Assertion<>( "Must forward hashCode", new NumberEnvelope(nbr) { }.hashCode(), @@ -127,7 +126,7 @@ void hashCode(final Number nbr) throws IOException { @ParameterizedTest @ArgumentsSource(NumberEnvelopeTest.class) - void equalsNumber(final Number nbr) throws IOException { + void equalsNumber(final Number nbr) { new Assertion<>( "Must forward equals and be true for correct Number", new NumberEnvelope(nbr) { }.equals(nbr), @@ -137,7 +136,7 @@ void equalsNumber(final Number nbr) throws IOException { @ParameterizedTest @ArgumentsSource(NumberEnvelopeTest.class) - void notEquals(final Number nbr) throws IOException { + void notEquals(final Number nbr) { new Assertion<>( "Must forward equals and be false for Object", new NumberEnvelope(nbr) { }.equals(new Object()), @@ -148,7 +147,7 @@ void notEquals(final Number nbr) throws IOException { @ParameterizedTest @ArgumentsSource(NumberEnvelopeTest.class) @SuppressWarnings("unlikely-arg-type") - void notEqualsObject(final Number nbr) throws IOException { + void notEqualsObject(final Number nbr) { new Assertion<>( "Must forward equals and be false for incorrect Number", new NumberEnvelope(nbr) { }.equals(-1), @@ -158,7 +157,7 @@ void notEqualsObject(final Number nbr) throws IOException { @ParameterizedTest @ArgumentsSource(NumberEnvelopeTest.class) - void toString(final Number nbr) throws IOException { + void toString(final Number nbr) { new Assertion<>( "Must forward toString", new NumberEnvelope(nbr) { }.toString(), diff --git a/src/test/java/org/cactoos/number/NumberOfScalarsTest.java b/src/test/java/org/cactoos/number/NumberOfScalarsTest.java index 7b67dfd2e..07aae3b2e 100644 --- a/src/test/java/org/cactoos/number/NumberOfScalarsTest.java +++ b/src/test/java/org/cactoos/number/NumberOfScalarsTest.java @@ -23,7 +23,6 @@ */ package org.cactoos.number; -import java.io.IOException; import java.util.stream.Stream; import org.hamcrest.core.IsEqual; import org.hamcrest.core.IsNot; @@ -57,7 +56,7 @@ public Stream provideArguments(final ExtensionContext ctx) { @ParameterizedTest @ArgumentsSource(NumberEnvelopeTest.class) - void floatValue(final Number nbr) throws IOException { + void floatValue(final Number nbr) { new Assertion<>( "Must implement floatValue", new NumberOfScalars(() -> nbr).floatValue(), @@ -67,7 +66,7 @@ void floatValue(final Number nbr) throws IOException { @ParameterizedTest @ArgumentsSource(NumberEnvelopeTest.class) - void intValue(final Number nbr) throws IOException { + void intValue(final Number nbr) { new Assertion<>( "Must implement intValue", new NumberOfScalars(() -> nbr).intValue(), @@ -77,7 +76,7 @@ void intValue(final Number nbr) throws IOException { @ParameterizedTest @ArgumentsSource(NumberEnvelopeTest.class) - void doubleValue(final Number nbr) throws IOException { + void doubleValue(final Number nbr) { new Assertion<>( "Must implement doubleValue", new NumberOfScalars(() -> nbr).doubleValue(), @@ -87,7 +86,7 @@ void doubleValue(final Number nbr) throws IOException { @ParameterizedTest @ArgumentsSource(NumberEnvelopeTest.class) - void longValue(final Number nbr) throws IOException { + void longValue(final Number nbr) { new Assertion<>( "Must implement longValue", new NumberOfScalars(() -> nbr).longValue(), @@ -97,7 +96,7 @@ void longValue(final Number nbr) throws IOException { @ParameterizedTest @ArgumentsSource(NumberEnvelopeTest.class) - void byteValue(final Number nbr) throws IOException { + void byteValue(final Number nbr) { new Assertion<>( "Must implement byteValue", new NumberOfScalars(() -> nbr).byteValue(), @@ -107,7 +106,7 @@ void byteValue(final Number nbr) throws IOException { @ParameterizedTest @ArgumentsSource(NumberEnvelopeTest.class) - void shortValue(final Number nbr) throws IOException { + void shortValue(final Number nbr) { new Assertion<>( "Must implement shortValue", new NumberOfScalars(() -> nbr).shortValue(), @@ -117,7 +116,7 @@ void shortValue(final Number nbr) throws IOException { @ParameterizedTest @ArgumentsSource(NumberEnvelopeTest.class) - void hashCode(final Number nbr) throws IOException { + void hashCode(final Number nbr) { new Assertion<>( "Must implement hashCode via doubleValue", new NumberOfScalars(() -> nbr).hashCode(), @@ -128,7 +127,7 @@ void hashCode(final Number nbr) throws IOException { @ParameterizedTest @ArgumentsSource(NumberEnvelopeTest.class) @SuppressWarnings("unlikely-arg-type") - void equalsNumber(final Number nbr) throws IOException { + void equalsNumber(final Number nbr) { new Assertion<>( "Must implement equals doubleValue", new NumberOfScalars(() -> nbr).equals(nbr.doubleValue()), @@ -138,7 +137,7 @@ void equalsNumber(final Number nbr) throws IOException { @ParameterizedTest @ArgumentsSource(NumberEnvelopeTest.class) - void notEquals(final Number nbr) throws IOException { + void notEquals(final Number nbr) { new Assertion<>( "Must implement not equals Object", new NumberOfScalars(() -> nbr).equals(new Object()), @@ -149,7 +148,7 @@ void notEquals(final Number nbr) throws IOException { @ParameterizedTest @ArgumentsSource(NumberEnvelopeTest.class) @SuppressWarnings("unlikely-arg-type") - void notEqualsObject(final Number nbr) throws IOException { + void notEqualsObject(final Number nbr) { new Assertion<>( "Must implement not equals incorrect value", new NumberOfScalars(() -> nbr).equals(-1.0), @@ -159,7 +158,7 @@ void notEqualsObject(final Number nbr) throws IOException { @ParameterizedTest @ArgumentsSource(NumberEnvelopeTest.class) - void toString(final Number nbr) throws IOException { + void toString(final Number nbr) { new Assertion<>( "Must implement toString via doubleValue", new NumberOfScalars(() -> nbr).toString(), diff --git a/src/test/java/org/cactoos/number/NumberOfTest.java b/src/test/java/org/cactoos/number/NumberOfTest.java index 058e7bbdd..8e6506245 100644 --- a/src/test/java/org/cactoos/number/NumberOfTest.java +++ b/src/test/java/org/cactoos/number/NumberOfTest.java @@ -23,7 +23,6 @@ */ package org.cactoos.number; -import java.io.IOException; import org.cactoos.text.TextOf; import org.junit.jupiter.api.Test; import org.llorllale.cactoos.matchers.Assertion; @@ -38,7 +37,7 @@ final class NumberOfTest { @Test - void parsesFloat() throws IOException { + void parsesFloat() { new Assertion<>( "Must parse float number", new NumberOf("1656.894").floatValue(), @@ -47,7 +46,7 @@ void parsesFloat() throws IOException { } @Test - void failsIfTextDoesNotRepresentAFloat() throws IOException { + void failsIfTextDoesNotRepresentAFloat() { new Assertion<>( "Must fail parsing random text as float", () -> new NumberOf("abcfds").floatValue(), @@ -56,7 +55,7 @@ void failsIfTextDoesNotRepresentAFloat() throws IOException { } @Test - void parsesLong() throws IOException { + void parsesLong() { new Assertion<>( "Must parse long number", new NumberOf("186789235425346").longValue(), @@ -65,7 +64,7 @@ void parsesLong() throws IOException { } @Test - void failsIfTextDoesNotRepresentALong() throws IOException { + void failsIfTextDoesNotRepresentALong() { new Assertion<>( "Must fail parsing random text as long", () -> new NumberOf("abcddd").longValue(), @@ -74,7 +73,7 @@ void failsIfTextDoesNotRepresentALong() throws IOException { } @Test - void parsesInteger() throws IOException { + void parsesInteger() { new Assertion<>( "Must parse integer number", new NumberOf("1867892354").intValue(), @@ -83,7 +82,7 @@ void parsesInteger() throws IOException { } @Test - void failsIfTextDoesNotRepresentAnInt() throws IOException { + void failsIfTextDoesNotRepresentAnInt() { new Assertion<>( "Must fail parsing random text as int", () -> new NumberOf("abc fdsf").intValue(), @@ -92,7 +91,7 @@ void failsIfTextDoesNotRepresentAnInt() throws IOException { } @Test - void parsesDouble() throws IOException { + void parsesDouble() { new Assertion<>( "Must parse double number", new NumberOf("185.65156465123").doubleValue(), @@ -101,7 +100,7 @@ void parsesDouble() throws IOException { } @Test - void failsIfTextDoesNotRepresentADouble() throws IOException { + void failsIfTextDoesNotRepresentADouble() { new Assertion<>( "Must fail parsing random text as double", () -> new NumberOf("abfdsc").doubleValue(), @@ -110,7 +109,7 @@ void failsIfTextDoesNotRepresentADouble() throws IOException { } @Test - void parsesValueInt() throws IOException { + void parsesValueInt() { new Assertion<>( "Must parse into int", new NumberOf("185").intValue(), @@ -119,7 +118,7 @@ void parsesValueInt() throws IOException { } @Test - void parsesValueIntFromText() throws IOException { + void parsesValueIntFromText() { new Assertion<>( "Must parse from text", new NumberOf(new TextOf("186")).intValue(), diff --git a/src/test/java/org/cactoos/proc/BiProcOfTest.java b/src/test/java/org/cactoos/proc/BiProcOfTest.java index 5c79f5af6..5b6f992a1 100644 --- a/src/test/java/org/cactoos/proc/BiProcOfTest.java +++ b/src/test/java/org/cactoos/proc/BiProcOfTest.java @@ -37,7 +37,7 @@ @SuppressWarnings("PMD.AvoidDuplicateLiterals") final class BiProcOfTest { @Test - void worksWithFunc() throws Exception { + void worksWithFunc() { final AtomicReference done = new AtomicReference<>(); new Assertion<>( "Must execute BiProc with Func", @@ -59,7 +59,7 @@ void worksWithFunc() throws Exception { } @Test - void worksWithBiFunc() throws Exception { + void worksWithBiFunc() { final AtomicReference done = new AtomicReference<>(); new Assertion<>( "Must execute BiProc with BiFunc", @@ -81,7 +81,7 @@ void worksWithBiFunc() throws Exception { } @Test - void worksWithProc() throws Exception { + void worksWithProc() { final AtomicReference done = new AtomicReference<>(); new Assertion<>( "Must execute BiProc with Proc", @@ -102,7 +102,7 @@ void worksWithProc() throws Exception { } @Test - void worksWithBiProc() throws Exception { + void worksWithBiProc() { final AtomicReference done = new AtomicReference<>(); new Assertion<>( "Must execute BiProc with BiProc", @@ -123,7 +123,7 @@ void worksWithBiProc() throws Exception { } @Test - void worksWithTwoProcs() throws Exception { + void worksWithTwoProcs() { final AtomicInteger fst = new AtomicInteger(); final AtomicInteger snd = new AtomicInteger(); new Assertion<>( diff --git a/src/test/java/org/cactoos/proc/ProcOfTest.java b/src/test/java/org/cactoos/proc/ProcOfTest.java index 66c9118cd..48dc7bace 100644 --- a/src/test/java/org/cactoos/proc/ProcOfTest.java +++ b/src/test/java/org/cactoos/proc/ProcOfTest.java @@ -36,7 +36,7 @@ */ final class ProcOfTest { @Test - void worksWithFunc() throws Exception { + void worksWithFunc() { final AtomicReference done = new AtomicReference<>(); new Assertion<>( "Must execute Proc with Func", @@ -59,7 +59,7 @@ void worksWithFunc() throws Exception { } @Test - void worksWithLambda() throws Exception { + void worksWithLambda() { final AtomicReference done = new AtomicReference<>(); new Assertion<>( "Must execute Proc with Lambda", diff --git a/src/test/java/org/cactoos/proc/RepeatedProcTest.java b/src/test/java/org/cactoos/proc/RepeatedProcTest.java index bc13dbcbe..ec648b6d0 100644 --- a/src/test/java/org/cactoos/proc/RepeatedProcTest.java +++ b/src/test/java/org/cactoos/proc/RepeatedProcTest.java @@ -53,7 +53,7 @@ void runsProcMultipleTimes() throws Exception { } @Test - void throwsIfZero() throws Exception { + void throwsIfZero() { new Assertion<>( "Must throw if zero", () -> { diff --git a/src/test/java/org/cactoos/scalar/AndInThreadsTest.java b/src/test/java/org/cactoos/scalar/AndInThreadsTest.java index cf0e3734b..2e4c4b519 100644 --- a/src/test/java/org/cactoos/scalar/AndInThreadsTest.java +++ b/src/test/java/org/cactoos/scalar/AndInThreadsTest.java @@ -149,45 +149,55 @@ void worksWithIterableScalarBoolean() { } @Test + @SuppressWarnings("PMD.CloseResource") void worksWithExecServiceProcValues() throws Exception { final List list = new Synced<>(new ListOf<>()); final ExecutorService service = Executors.newSingleThreadExecutor(); - new AndInThreads( - service, - new ProcNoNulls(list::add), - 1, 2 - ).value(); - new Assertion<>( - "Result should be calculated for proc values", - list, - new IsIterableContainingInAnyOrder<>( - new ListOf<>( - new IsEqual<>(1), - new IsEqual<>(2) + try { + new AndInThreads( + service, + new ProcNoNulls(list::add), + 1, 2 + ).value(); + new Assertion<>( + "Result should be calculated for proc values", + list, + new IsIterableContainingInAnyOrder<>( + new ListOf<>( + new IsEqual<>(1), + new IsEqual<>(2) + ) ) - ) - ).affirm(); + ).affirm(); + } finally { + service.shutdown(); + } } @Test + @SuppressWarnings("PMD.CloseResource") void worksWithExecServiceProcIterable() throws Exception { final List list = new Synced<>(new ListOf<>()); final ExecutorService service = Executors.newSingleThreadExecutor(); - new AndInThreads( - service, - new ProcNoNulls(list::add), - new ListOf<>(1, 2) - ).value(); - new Assertion<>( - "Result should be calculated for proc iterables", - list, - new IsIterableContainingInAnyOrder<>( - new ListOf<>( - new IsEqual<>(1), - new IsEqual<>(2) + try { + new AndInThreads( + service, + new ProcNoNulls(list::add), + new ListOf<>(1, 2) + ).value(); + new Assertion<>( + "Result should be calculated for proc iterables", + list, + new IsIterableContainingInAnyOrder<>( + new ListOf<>( + new IsEqual<>(1), + new IsEqual<>(2) + ) ) - ) - ).affirm(); + ).affirm(); + } finally { + service.shutdown(); + } } @Test diff --git a/src/test/java/org/cactoos/scalar/BoolOfTest.java b/src/test/java/org/cactoos/scalar/BoolOfTest.java index 49b2a42ba..9a5f2c686 100644 --- a/src/test/java/org/cactoos/scalar/BoolOfTest.java +++ b/src/test/java/org/cactoos/scalar/BoolOfTest.java @@ -36,7 +36,7 @@ final class BoolOfTest { @Test - void trueTest() throws Exception { + void trueTest() { new Assertion<>( "Must be parsed string 'true'", new BoolOf("true"), @@ -45,7 +45,7 @@ void trueTest() throws Exception { } @Test - void falseTest() throws Exception { + void falseTest() { new Assertion<>( "Must be parsed string 'false'", new BoolOf("false"), @@ -54,7 +54,7 @@ void falseTest() throws Exception { } @Test - void isFalseIfTextDoesNotRepresentABoolean() throws Exception { + void isFalseIfTextDoesNotRepresentABoolean() { new Assertion<>( "Must be parsed a non-boolean string", new BoolOf("abc"), diff --git a/src/test/java/org/cactoos/scalar/CheckedTest.java b/src/test/java/org/cactoos/scalar/CheckedTest.java index 871389ad1..68cccef93 100644 --- a/src/test/java/org/cactoos/scalar/CheckedTest.java +++ b/src/test/java/org/cactoos/scalar/CheckedTest.java @@ -40,7 +40,7 @@ final class CheckedTest { @Test - void runtimeExceptionGoesOut() throws Exception { + void runtimeExceptionGoesOut() { new Assertion<>( "Must throw runtime exception", () -> new Checked<>( @@ -54,7 +54,7 @@ void runtimeExceptionGoesOut() throws Exception { } @Test - void usesGenericVarianceOnExceptionTypes() throws Exception { + void usesGenericVarianceOnExceptionTypes() { new Assertion<>( "Must use generic variance on exception types", () -> new Checked( @@ -82,7 +82,7 @@ void usesContravarianceOnResultType() throws Exception { } @Test - void throwsIoException() throws Exception { + void throwsIoException() { new Assertion<>( "Must throw io exception", () -> new Checked<>( @@ -96,7 +96,7 @@ void throwsIoException() throws Exception { } @Test - void ioExceptionGoesOut() throws Exception { + void ioExceptionGoesOut() { try { new Checked<>( () -> { @@ -132,7 +132,7 @@ void fileNotFoundExceptionGoesOut() throws Exception { } @Test - void throwsIoExceptionWithModifiedMessage() throws Exception { + void throwsIoExceptionWithModifiedMessage() { final String message = "error msg"; new Assertion<>( "Must throw io exception with modified message", diff --git a/src/test/java/org/cactoos/scalar/ConstantTest.java b/src/test/java/org/cactoos/scalar/ConstantTest.java index 2bcbc39b2..4b4561290 100644 --- a/src/test/java/org/cactoos/scalar/ConstantTest.java +++ b/src/test/java/org/cactoos/scalar/ConstantTest.java @@ -35,7 +35,7 @@ final class ConstantTest { @Test - void returnsGivenValue() throws Exception { + void returnsGivenValue() { final String value = "Hello World"; new Assertion<>( "Must return given value", @@ -45,7 +45,7 @@ void returnsGivenValue() throws Exception { } @Test - void alwaysReturnsSameValue() throws Exception { + void alwaysReturnsSameValue() { final Constant constant = new Constant<>("Good Bye!"); new Assertion<>( "Must return same value", diff --git a/src/test/java/org/cactoos/scalar/EqualityTest.java b/src/test/java/org/cactoos/scalar/EqualityTest.java index 3ff435309..3760bc143 100644 --- a/src/test/java/org/cactoos/scalar/EqualityTest.java +++ b/src/test/java/org/cactoos/scalar/EqualityTest.java @@ -36,7 +36,7 @@ final class EqualityTest { @Test - void notEqualLeft() throws Exception { + void notEqualLeft() { new Assertion<>( "Must compare smaller to greater", new Equality<>( @@ -47,7 +47,7 @@ void notEqualLeft() throws Exception { } @Test - void notEqualRight() throws Exception { + void notEqualRight() { new Assertion<>( "Must compare greater to smaller", new Equality<>( @@ -58,7 +58,7 @@ void notEqualRight() throws Exception { } @Test - void notEqualLeftWithSameSize() throws Exception { + void notEqualLeftWithSameSize() { new Assertion<>( "Must compare smaller to smaller with same size", new Equality<>( @@ -69,7 +69,7 @@ void notEqualLeftWithSameSize() throws Exception { } @Test - void notEqualRightWithSameSize() throws Exception { + void notEqualRightWithSameSize() { new Assertion<>( "Must compare greater to smaller with same size", new Equality<>( @@ -80,7 +80,7 @@ void notEqualRightWithSameSize() throws Exception { } @Test - void equal() throws Exception { + void equal() { new Assertion<>( "Must compare equals", new Equality<>( @@ -91,7 +91,7 @@ void equal() throws Exception { } @Test - void compareEmptyArrays() throws Exception { + void compareEmptyArrays() { new Assertion<>( "Must compare empty", new Equality<>( diff --git a/src/test/java/org/cactoos/scalar/EqualsNullableTest.java b/src/test/java/org/cactoos/scalar/EqualsNullableTest.java index ac746c40f..029b0a443 100644 --- a/src/test/java/org/cactoos/scalar/EqualsNullableTest.java +++ b/src/test/java/org/cactoos/scalar/EqualsNullableTest.java @@ -37,7 +37,7 @@ final class EqualsNullableTest { @Test - void nullEqualsNull() throws Exception { + void nullEqualsNull() { new Assertion<>( "Must return true for both null objects", new EqualsNullable(() -> null, () -> null), @@ -46,7 +46,7 @@ void nullEqualsNull() throws Exception { } @Test - void equals() throws Exception { + void equals() { new Assertion<>( "Must return true for equal objects", new EqualsNullable(1, 1), @@ -55,7 +55,7 @@ void equals() throws Exception { } @Test - void notEquals() throws Exception { + void notEquals() { new Assertion<>( "Must return false for non equal objects", new EqualsNullable(1, 2), @@ -64,7 +64,7 @@ void notEquals() throws Exception { } @Test - void equalsObjectAndScalar() throws Exception { + void equalsObjectAndScalar() { new Assertion<>( "Must return true for object and scalar with the same value", new EqualsNullable(1, () -> 1), @@ -73,7 +73,7 @@ void equalsObjectAndScalar() throws Exception { } @Test - void equalsScalarAndObject() throws Exception { + void equalsScalarAndObject() { new Assertion<>( "Must return true for scalar and object with the same value", new EqualsNullable(() -> 1, 1), diff --git a/src/test/java/org/cactoos/scalar/EqualsTest.java b/src/test/java/org/cactoos/scalar/EqualsTest.java index cbbfd78ff..ac2df0de9 100644 --- a/src/test/java/org/cactoos/scalar/EqualsTest.java +++ b/src/test/java/org/cactoos/scalar/EqualsTest.java @@ -38,7 +38,7 @@ final class EqualsTest { @Test - void compareEquals() throws Exception { + void compareEquals() { new Assertion<>( "Must compare if two integers are equal", new Equals<>(1, 1), @@ -47,7 +47,7 @@ void compareEquals() throws Exception { } @Test - void compareNotEquals() throws Exception { + void compareNotEquals() { new Assertion<>( "Must compare if two integers are not equal", new Equals<>(1, 2), @@ -56,7 +56,7 @@ void compareNotEquals() throws Exception { } @Test - void compareEqualsTextScalar() throws Exception { + void compareEqualsTextScalar() { final String str = "hello"; new Assertion<>( "Must compare if two strings are equal", @@ -66,7 +66,7 @@ void compareEqualsTextScalar() throws Exception { } @Test - void compareNotEqualsTextScalar() throws Exception { + void compareNotEqualsTextScalar() { new Assertion<>( "Must compare if two strings are not equal", new Equals<>("world", "worle"), @@ -75,7 +75,7 @@ void compareNotEqualsTextScalar() throws Exception { } @Test - void compareText() throws Exception { + void compareText() { new Assertion<>( "Must compare if two comparable test are equal, see #1174", new Equals<>( diff --git a/src/test/java/org/cactoos/scalar/FalseTest.java b/src/test/java/org/cactoos/scalar/FalseTest.java index db579cf57..1dd3b828d 100644 --- a/src/test/java/org/cactoos/scalar/FalseTest.java +++ b/src/test/java/org/cactoos/scalar/FalseTest.java @@ -37,7 +37,7 @@ final class FalseTest { @Test - void asValue() throws Exception { + void asValue() { new Assertion<>( "Must return false", new False().value(), @@ -46,7 +46,7 @@ void asValue() throws Exception { } @Test - void asScalar() throws Exception { + void asScalar() { new Assertion<>( "Must be false", new False(), diff --git a/src/test/java/org/cactoos/scalar/FoldedTest.java b/src/test/java/org/cactoos/scalar/FoldedTest.java index 395a3b9a6..8a3c29926 100644 --- a/src/test/java/org/cactoos/scalar/FoldedTest.java +++ b/src/test/java/org/cactoos/scalar/FoldedTest.java @@ -38,14 +38,14 @@ final class FoldedTest { @Test - void skipIterable() throws Exception { + void skipIterable() { new Assertion<>( "Must fold elements in iterable", new Folded<>( 0L, Long::sum, new HeadOf<>( 10, - new RangeOf<>(0L, Long.MAX_VALUE, value -> value + 1) + new RangeOf<>(0L, Long.MAX_VALUE, value -> value + 1L) ) ), new HasValue<>(45L) diff --git a/src/test/java/org/cactoos/scalar/HighestOfTest.java b/src/test/java/org/cactoos/scalar/HighestOfTest.java index 094893478..5edf5d38b 100644 --- a/src/test/java/org/cactoos/scalar/HighestOfTest.java +++ b/src/test/java/org/cactoos/scalar/HighestOfTest.java @@ -205,7 +205,7 @@ void highestCharAtIterable() throws Exception { } @Test - void highestSumAtIterable() throws Exception { + void highestSumAtIterable() { new Assertion<>( "Must find the highest double sum among many", new HighestOf<>( diff --git a/src/test/java/org/cactoos/scalar/LengthOfTest.java b/src/test/java/org/cactoos/scalar/LengthOfTest.java index 33820edc5..97212d8b3 100644 --- a/src/test/java/org/cactoos/scalar/LengthOfTest.java +++ b/src/test/java/org/cactoos/scalar/LengthOfTest.java @@ -63,7 +63,7 @@ void lengthOfInputWithCustomBuffer() { } @Test - void lengthOfZeroBuffer() throws Exception { + void lengthOfZeroBuffer() { new Assertion<>( "Must fail to calculate length of empty buffer", () -> new LengthOf( @@ -75,7 +75,7 @@ void lengthOfZeroBuffer() throws Exception { } @Test - void lengthOf() throws Exception { + void lengthOf() { new Assertion<>( "Must calculate length of iterable for integer", new LengthOf( diff --git a/src/test/java/org/cactoos/scalar/LowestOfTest.java b/src/test/java/org/cactoos/scalar/LowestOfTest.java index 54453da97..2f219af4e 100644 --- a/src/test/java/org/cactoos/scalar/LowestOfTest.java +++ b/src/test/java/org/cactoos/scalar/LowestOfTest.java @@ -228,7 +228,7 @@ void lowestCharAtIterable() throws Exception { } @Test - void lowestSumAtIterable() throws Exception { + void lowestSumAtIterable() { new Assertion<>( "Must find the lowest double sum among many", new LowestOf<>( diff --git a/src/test/java/org/cactoos/scalar/MappedTest.java b/src/test/java/org/cactoos/scalar/MappedTest.java index 3bb2459d5..951c3deb4 100644 --- a/src/test/java/org/cactoos/scalar/MappedTest.java +++ b/src/test/java/org/cactoos/scalar/MappedTest.java @@ -39,7 +39,7 @@ */ final class MappedTest { @Test - void transformsScalar() throws Exception { + void transformsScalar() { new Assertion<>( "must transform scalar", new Mapped( diff --git a/src/test/java/org/cactoos/scalar/RetryTest.java b/src/test/java/org/cactoos/scalar/RetryTest.java index f04eaaa61..a9eb64b86 100644 --- a/src/test/java/org/cactoos/scalar/RetryTest.java +++ b/src/test/java/org/cactoos/scalar/RetryTest.java @@ -91,7 +91,7 @@ void runsScalarMultipleTimesIgnoringNegativeDuration() { return 0; }, Integer.MAX_VALUE, - Duration.of(-5, ChronoUnit.DAYS) + Duration.of(-5L, ChronoUnit.DAYS) ), new HasValue<>(0) ).affirm(); @@ -101,7 +101,7 @@ void runsScalarMultipleTimesIgnoringNegativeDuration() { @SuppressWarnings("PMD.AvoidInstantiatingObjectsInLoops") void runsScalarMultipleTimesWithWait() throws Exception { final int times = 3; - final long wait = 500; + final long wait = 500L; final AtomicInteger tries = new AtomicInteger(0); final List executions = new ArrayList<>(times); new Retry<>( diff --git a/src/test/java/org/cactoos/scalar/ScalarWithFallbackTest.java b/src/test/java/org/cactoos/scalar/ScalarWithFallbackTest.java index 1c360a094..472aaecf6 100644 --- a/src/test/java/org/cactoos/scalar/ScalarWithFallbackTest.java +++ b/src/test/java/org/cactoos/scalar/ScalarWithFallbackTest.java @@ -44,7 +44,7 @@ final class ScalarWithFallbackTest { @Test - void usesMainFunc() throws Exception { + void usesMainFunc() { final String message = "Main function's result #1"; new Assertion<>( "Must use the main function if no exception", @@ -62,7 +62,7 @@ void usesMainFunc() throws Exception { } @Test - void usesMainFuncFromExceptionAndFallback() throws Exception { + void usesMainFuncFromExceptionAndFallback() { final String message = "Main function's result #1 (exp & flbck)"; new Assertion<>( "Using the main function if no exception (exp & flbck)", @@ -78,7 +78,7 @@ void usesMainFuncFromExceptionAndFallback() throws Exception { } @Test - void usesMainFuncFromIterableExceptionAndFallback() throws Exception { + void usesMainFuncFromIterableExceptionAndFallback() { final String message = "Main function's result #1 (exp iterable & flbck)"; new Assertion<>( "Using the main function if no exception (exp iterable & flbck)", @@ -94,7 +94,7 @@ void usesMainFuncFromIterableExceptionAndFallback() throws Exception { } @Test - void usesFallback() throws Exception { + void usesFallback() { final String message = "Fallback from IOException"; new Assertion<>( "Must use a single fallback in case of exception", @@ -117,7 +117,7 @@ void usesFallback() throws Exception { } @Test - void usesFallbackFromExceptionAndFallback() throws Exception { + void usesFallbackFromExceptionAndFallback() { final String message = "Fallback from IOException (exp & flbck)"; new Assertion<>( "Using a single fallback in case of exception (exp & flbck)", @@ -135,7 +135,7 @@ void usesFallbackFromExceptionAndFallback() throws Exception { } @Test - void usesFallbackFromIterableExceptionAndFallback() throws Exception { + void usesFallbackFromIterableExceptionAndFallback() { final String message = "Fallback from IOException (exp iterable & flbck)"; new Assertion<>( "Using a single fallback in case of exception (exp iterable & flbck)", @@ -153,7 +153,7 @@ void usesFallbackFromIterableExceptionAndFallback() throws Exception { } @Test - void usesFallbackOfInterruptedException() throws Exception { + void usesFallbackOfInterruptedException() { final String message = "Fallback from InterruptedException"; new Assertion<>( "Must use a fallback from Interrupted in case of exception", @@ -175,7 +175,7 @@ void usesFallbackOfInterruptedException() throws Exception { } @Test - void usesTheClosestFallback() throws Exception { + void usesTheClosestFallback() { final String expected = "Fallback from IllegalFormatException"; new Assertion<>( "Must find the closest fallback", diff --git a/src/test/java/org/cactoos/scalar/TernaryTest.java b/src/test/java/org/cactoos/scalar/TernaryTest.java index 4bd6aef38..8e5019f7a 100644 --- a/src/test/java/org/cactoos/scalar/TernaryTest.java +++ b/src/test/java/org/cactoos/scalar/TernaryTest.java @@ -41,7 +41,7 @@ final class TernaryTest { @Test - void conditionTrueScalar() throws Exception { + void conditionTrueScalar() { new Assertion<>( "Must work with true scalar condition", new Ternary<>( @@ -54,7 +54,7 @@ void conditionTrueScalar() throws Exception { } @Test - void conditionFalseScalar() throws Exception { + void conditionFalseScalar() { new Assertion<>( "Must work with false scalar condition", new Ternary<>( @@ -67,7 +67,7 @@ void conditionFalseScalar() throws Exception { } @Test - void conditionStatic() throws Exception { + void conditionStatic() { new Assertion<>( "Must work with primitive static condition", new Ternary<>( @@ -80,7 +80,7 @@ void conditionStatic() throws Exception { } @Test - void consequentScalar() throws Exception { + void consequentScalar() { new Assertion<>( "Must work with scalar consequent and alternative", new Ternary<>( @@ -93,7 +93,7 @@ void consequentScalar() throws Exception { } @Test - void inputStatic() throws Exception { + void inputStatic() { new Assertion<>( "Must call the functions with the input", new Ternary<>( @@ -107,7 +107,7 @@ void inputStatic() throws Exception { } @Test - void inputScalar() throws Exception { + void inputScalar() { new Assertion<>( "Must call the functions with the input scalar value", new Ternary<>( @@ -122,7 +122,7 @@ void inputScalar() throws Exception { @Test @SuppressWarnings("unchecked") - void inputScalarValueConserved() throws Exception { + void inputScalarValueConserved() { new Assertion>( "Must conserve the same scalar value for each whole evaluation", new Ternary<>( diff --git a/src/test/java/org/cactoos/scalar/ThrowsOnFalseTest.java b/src/test/java/org/cactoos/scalar/ThrowsOnFalseTest.java index c62be1308..b4fe18ccb 100644 --- a/src/test/java/org/cactoos/scalar/ThrowsOnFalseTest.java +++ b/src/test/java/org/cactoos/scalar/ThrowsOnFalseTest.java @@ -37,7 +37,7 @@ final class ThrowsOnFalseTest { @Test - void throwsOnFalse() throws Exception { + void throwsOnFalse() { final String message = "test message"; new Assertion<>( "Throws an exception", @@ -49,7 +49,7 @@ void throwsOnFalse() throws Exception { } @Test - void throwsSuppliedExceptionOnFalse() throws Exception { + void throwsSuppliedExceptionOnFalse() { final String message = "illegal state"; new Assertion<>( "Throws supplied exception", diff --git a/src/test/java/org/cactoos/scalar/TrueTest.java b/src/test/java/org/cactoos/scalar/TrueTest.java index 5f3e1e417..9ad8cc2d9 100644 --- a/src/test/java/org/cactoos/scalar/TrueTest.java +++ b/src/test/java/org/cactoos/scalar/TrueTest.java @@ -36,7 +36,7 @@ final class TrueTest { @Test - void asValue() throws Exception { + void asValue() { new Assertion<>( "Must be True", new True().value(), diff --git a/src/test/java/org/cactoos/scalar/XorTest.java b/src/test/java/org/cactoos/scalar/XorTest.java index 8d8cec6ce..fe89a5940 100644 --- a/src/test/java/org/cactoos/scalar/XorTest.java +++ b/src/test/java/org/cactoos/scalar/XorTest.java @@ -37,7 +37,7 @@ final class XorTest { @Test - void trueTrue() throws Exception { + void trueTrue() { new Assertion<>( "Either one, but not both nor none", new Xor( @@ -49,7 +49,7 @@ void trueTrue() throws Exception { } @Test - void falseTrue() throws Exception { + void falseTrue() { new Assertion<>( "Either one, but not both nor none", new Xor( @@ -61,7 +61,7 @@ void falseTrue() throws Exception { } @Test - void treuFalse() throws Exception { + void treuFalse() { new Assertion<>( "Either one, but not both nor none", new Xor( @@ -73,7 +73,7 @@ void treuFalse() throws Exception { } @Test - void falseFalse() throws Exception { + void falseFalse() { new Assertion<>( "Either one, but not both nor none", new Xor( @@ -85,7 +85,7 @@ void falseFalse() throws Exception { } @Test - void singleTrue() throws Exception { + void singleTrue() { new Assertion<>( "Single True must be True", new Xor( @@ -96,7 +96,7 @@ void singleTrue() throws Exception { } @Test - void singleFalse() throws Exception { + void singleFalse() { new Assertion<>( "Single False must be False", new Xor( @@ -107,7 +107,7 @@ void singleFalse() throws Exception { } @Test - void emptyIterable() throws Exception { + void emptyIterable() { new Assertion<>( "Empty iterable must be False", new Xor(new IterableOf>()), @@ -116,7 +116,7 @@ void emptyIterable() throws Exception { } @Test - void oddNumberOfTrue() throws Exception { + void oddNumberOfTrue() { new Assertion<>( "Odd number of True must be True", new Xor( @@ -129,7 +129,7 @@ void oddNumberOfTrue() throws Exception { } @Test - void evenNumberOfTrue() throws Exception { + void evenNumberOfTrue() { new Assertion<>( "Even number of True must be False", new Xor( @@ -142,7 +142,7 @@ void evenNumberOfTrue() throws Exception { } @Test - void allFalse() throws Exception { + void allFalse() { new Assertion<>( "All False must be False", new Xor( @@ -155,7 +155,7 @@ void allFalse() throws Exception { } @Test - void allTrue() throws Exception { + void allTrue() { new Assertion<>( "Odd number of True must be True", new Xor( diff --git a/src/test/java/org/cactoos/text/Base64DecodedTest.java b/src/test/java/org/cactoos/text/Base64DecodedTest.java index 41b400eae..e7c31eda5 100644 --- a/src/test/java/org/cactoos/text/Base64DecodedTest.java +++ b/src/test/java/org/cactoos/text/Base64DecodedTest.java @@ -24,7 +24,6 @@ package org.cactoos.text; -import java.io.IOException; import org.junit.jupiter.api.Test; import org.llorllale.cactoos.matchers.Assertion; import org.llorllale.cactoos.matchers.HasString; @@ -38,10 +37,9 @@ final class Base64DecodedTest { /** * Check text decodes using the Base64 encoding scheme. - * @throws IOException If fails. */ @Test - void checkDecode() throws IOException { + void checkDecode() { new Assertion<>( "Can't decodes text using the Base64 encoding scheme", new Base64Decoded( diff --git a/src/test/java/org/cactoos/text/Base64EncodedTest.java b/src/test/java/org/cactoos/text/Base64EncodedTest.java index 02027726d..ac2722e92 100644 --- a/src/test/java/org/cactoos/text/Base64EncodedTest.java +++ b/src/test/java/org/cactoos/text/Base64EncodedTest.java @@ -24,7 +24,6 @@ package org.cactoos.text; -import java.io.IOException; import org.junit.jupiter.api.Test; import org.llorllale.cactoos.matchers.Assertion; import org.llorllale.cactoos.matchers.HasString; @@ -37,10 +36,9 @@ final class Base64EncodedTest { /** * Check text encodes using the Base64 encoding scheme. - * @throws IOException If fails. */ @Test - void checkEncode() throws IOException { + void checkEncode() { new Assertion<>( "Can't encodes text using the Base64 encoding scheme", new Base64Encoded( diff --git a/src/test/java/org/cactoos/text/HexOfTest.java b/src/test/java/org/cactoos/text/HexOfTest.java index 91196e38c..a54dcf8fa 100644 --- a/src/test/java/org/cactoos/text/HexOfTest.java +++ b/src/test/java/org/cactoos/text/HexOfTest.java @@ -23,7 +23,6 @@ */ package org.cactoos.text; -import java.io.IOException; import org.cactoos.bytes.BytesOf; import org.junit.jupiter.api.Test; import org.llorllale.cactoos.matchers.Assertion; @@ -48,7 +47,7 @@ void empytString() { } @Test - void notEmpytString() throws IOException { + void notEmpytString() { new Assertion<>( "Can't represent a string as hexadecimal", new HexOf( diff --git a/src/test/java/org/cactoos/text/SplitTest.java b/src/test/java/org/cactoos/text/SplitTest.java index 9e63186e6..fcc6b6418 100644 --- a/src/test/java/org/cactoos/text/SplitTest.java +++ b/src/test/java/org/cactoos/text/SplitTest.java @@ -38,7 +38,7 @@ final class SplitTest { @Test - void splitStringWithStringRegex() throws Exception { + void splitStringWithStringRegex() { new Assertion<>( "Must split string with string regex", new Split("Hello world!", "\\s+"), @@ -47,7 +47,7 @@ void splitStringWithStringRegex() throws Exception { } @Test - void splitStringWithTextRegex() throws Exception { + void splitStringWithTextRegex() { new Assertion<>( "Must split string with text regex", new Split("Cactoos OOP!", new TextOf("\\s")), @@ -56,7 +56,7 @@ void splitStringWithTextRegex() throws Exception { } @Test - void splitTextWithStringRegex() throws Exception { + void splitTextWithStringRegex() { new Assertion<>( "Must split text with string regex", new Split(new TextOf("Cact4Primitives!"), "\\d+"), @@ -65,7 +65,7 @@ void splitTextWithStringRegex() throws Exception { } @Test - void splitTextWithTextRegex() throws Exception { + void splitTextWithTextRegex() { new Assertion<>( "Must split text with text regex", new Split(new TextOf("Split#OOP"), new TextOf("#")), @@ -74,7 +74,7 @@ void splitTextWithTextRegex() throws Exception { } @Test - void splitStringWithStringRegexAndLimit() throws Exception { + void splitStringWithStringRegexAndLimit() { new Assertion<>( "Must split string with string regex and limit", new Split("Hello! ! world!", " ", 2), @@ -83,7 +83,7 @@ void splitStringWithStringRegexAndLimit() throws Exception { } @Test - void splitStringWithTextRegexAndLimit() throws Exception { + void splitStringWithTextRegexAndLimit() { new Assertion<>( "Must split string with text regex and limit", new Split("Cactoos! ! OOP!", new TextOf(" "), 2), @@ -92,7 +92,7 @@ void splitStringWithTextRegexAndLimit() throws Exception { } @Test - void splitTextWithStringRegexAndLimit() throws Exception { + void splitTextWithStringRegexAndLimit() { final Text txt = new TextOf("Cact!4Primitives"); new Assertion<>( "Must split text with string regex and limit", @@ -102,7 +102,7 @@ void splitTextWithStringRegexAndLimit() throws Exception { } @Test - void splitTextWithTextRegexAndLimit() throws Exception { + void splitTextWithTextRegexAndLimit() { final Text txt = new TextOf("Split!# #OOP"); new Assertion<>( "Must split text with text regex and limit", @@ -112,7 +112,7 @@ void splitTextWithTextRegexAndLimit() throws Exception { } @Test - void splitWithZeroLimit() throws Exception { + void splitWithZeroLimit() { new Assertion<>( "Must split string with string regex and zero limit", new Split("Hello. The! !world", " +", 0), @@ -123,7 +123,7 @@ void splitWithZeroLimit() throws Exception { } @Test - void splitWithNegativeLimit() throws Exception { + void splitWithNegativeLimit() { new Assertion<>( "Must split string with string regex and negative limit", new Split("Hello: The world", " ", -1), diff --git a/src/test/java/org/cactoos/text/TextOfDateTimeTest.java b/src/test/java/org/cactoos/text/TextOfDateTimeTest.java index 7356eb6a7..2a8ab3e6d 100644 --- a/src/test/java/org/cactoos/text/TextOfDateTimeTest.java +++ b/src/test/java/org/cactoos/text/TextOfDateTimeTest.java @@ -23,7 +23,6 @@ */ package org.cactoos.text; -import java.io.IOException; import java.text.MessageFormat; import java.time.LocalDate; import java.time.LocalDateTime; @@ -74,7 +73,7 @@ void readsLocalDateFormattedWithFormatStringWithLocale() { } @Test - void readsLocalDateFormattedAsIsoDateTime() throws IOException { + void readsLocalDateFormattedAsIsoDateTime() { final LocalDate date = LocalDate.of(2017, 12, 13); new Assertion<>( "Must format a LocalDate with default/ISO format.",