Skip to content

Commit

Permalink
Fixes: #1175 Replace RuntimeIOException with UncheckedIOException? (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
pswiatowski authored and joel-costigliola committed Feb 18, 2018
1 parent 48cbf8e commit a901973
Show file tree
Hide file tree
Showing 24 changed files with 143 additions and 188 deletions.
14 changes: 7 additions & 7 deletions src/main/java/org/assertj/core/api/AbstractFileAssert.java
Expand Up @@ -16,8 +16,8 @@
import static org.assertj.core.util.Preconditions.checkNotNull;

import java.io.File;
import java.io.UncheckedIOException;
import java.nio.charset.Charset;
import org.assertj.core.api.exception.RuntimeIOException;
import org.assertj.core.internal.Files;
import org.assertj.core.util.CheckReturnValue;
import org.assertj.core.util.VisibleForTesting;
Expand Down Expand Up @@ -228,7 +228,7 @@ public SELF isRelative() {
* @throws IllegalArgumentException if the given {@code File} is not an existing file.
* @throws AssertionError if the actual {@code File} is {@code null}.
* @throws AssertionError if the actual {@code File} is not an existing file.
* @throws RuntimeIOException if an I/O error occurs.
* @throws UncheckedIOException if an I/O error occurs.
* @throws AssertionError if the content of the actual {@code File} is not equal to the content of the given one.
*
* @deprecated use {@link #hasSameContentAs(File)} instead
Expand Down Expand Up @@ -266,7 +266,7 @@ public SELF hasContentEqualTo(File expected) {
* @throws IllegalArgumentException if the given {@code File} is not an existing file.
* @throws AssertionError if the actual {@code File} is {@code null}.
* @throws AssertionError if the actual {@code File} is not an existing file.
* @throws RuntimeIOException if an I/O error occurs.
* @throws UncheckedIOException if an I/O error occurs.
* @throws AssertionError if the content of the actual {@code File} is not equal to the content of the given one.
*/
public SELF hasSameContentAs(File expected) {
Expand Down Expand Up @@ -298,7 +298,7 @@ public SELF hasSameContentAs(File expected) {
* @throws IllegalArgumentException if the given {@code File} is not an existing file.
* @throws AssertionError if the actual {@code File} is {@code null}.
* @throws AssertionError if the actual {@code File} is not an existing file.
* @throws RuntimeIOException if an I/O error occurs.
* @throws UncheckedIOException if an I/O error occurs.
* @throws AssertionError if the content of the actual {@code File} is not equal to the content of the given one.
*/
public SELF hasSameContentAs(File expected, Charset expectedCharset) {
Expand All @@ -325,7 +325,7 @@ public SELF hasSameContentAs(File expected, Charset expectedCharset) {
* @throws NullPointerException if the given content is {@code null}.
* @throws AssertionError if the actual {@code File} is {@code null}.
* @throws AssertionError if the actual {@code File} is not an existing file.
* @throws RuntimeIOException if an I/O error occurs.
* @throws UncheckedIOException if an I/O error occurs.
* @throws AssertionError if the content of the actual {@code File} is not equal to the given binary content.
*/
public SELF hasBinaryContent(byte[] expected) {
Expand Down Expand Up @@ -391,7 +391,7 @@ public SELF usingCharset(Charset charset) {
* @throws NullPointerException if the given content is {@code null}.
* @throws AssertionError if the actual {@code File} is {@code null}.
* @throws AssertionError if the actual {@code File} is not an existing file.
* @throws RuntimeIOException if an I/O error occurs.
* @throws UncheckedIOException if an I/O error occurs.
* @throws AssertionError if the content of the actual {@code File} is not equal to the given content.
*/
public SELF hasContent(String expected) {
Expand Down Expand Up @@ -469,7 +469,7 @@ public SELF canRead() {
* @param expected the expected parent {@code File}.
* @return {@code this} assertion object.
* @throws NullPointerException if the expected parent {@code File} is {@code null}.
* @throws RuntimeIOException if an I/O error occurs.
* @throws UncheckedIOException if an I/O error occurs.
* @throws AssertionError if the actual {@code File} is {@code null}.
* @throws AssertionError if the actual {@code File} parent is not equal to the expected one.
*
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/org/assertj/core/api/AbstractPathAssert.java
Expand Up @@ -15,6 +15,7 @@
import static org.assertj.core.util.Preconditions.checkArgument;
import static org.assertj.core.util.Preconditions.checkNotNull;

import java.io.UncheckedIOException;
import java.nio.charset.Charset;
import java.nio.file.ClosedFileSystemException;
import java.nio.file.FileSystem;
Expand All @@ -25,7 +26,6 @@
import java.nio.file.spi.FileSystemProvider;

import org.assertj.core.api.exception.PathsException;
import org.assertj.core.api.exception.RuntimeIOException;
import org.assertj.core.internal.Paths;
import org.assertj.core.util.CheckReturnValue;
import org.assertj.core.util.VisibleForTesting;
Expand Down Expand Up @@ -181,7 +181,7 @@ public SELF hasSameContentAs(Path expected, Charset expectedCharset) {
* @throws NullPointerException if the given content is {@code null}.
* @throws AssertionError if the actual {@code File} is {@code null}.
* @throws AssertionError if the actual {@code File} is not an existing file.
* @throws RuntimeIOException if an I/O error occurs.
* @throws UncheckedIOException if an I/O error occurs.
* @throws AssertionError if the content of the actual {@code File} is not equal to the given binary content.
*/
public SELF hasBinaryContent(byte[] expected) {
Expand Down Expand Up @@ -261,7 +261,7 @@ public SELF usingCharset(Charset charset) {
* @param expected the expected text content to compare the actual {@code File}'s content to.
* @return {@code this} assertion object.
* @throws NullPointerException if the given content is {@code null}.
* @throws RuntimeIOException if an I/O error occurs.
* @throws UncheckedIOException if an I/O error occurs.
* @throws AssertionError if the actual {@code Path} is {@code null}.
* @throws AssertionError if the actual {@code Path} is not a {@link Files#isReadable(Path) readable} file.
* @throws AssertionError if the content of the actual {@code File} is not equal to the given content.
Expand Down
26 changes: 13 additions & 13 deletions src/main/java/org/assertj/core/api/Assertions.java
Expand Up @@ -18,6 +18,7 @@
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.UncheckedIOException;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.net.URI;
Expand Down Expand Up @@ -68,7 +69,6 @@
import java.util.stream.Stream;

import org.assertj.core.api.ThrowableAssert.ThrowingCallable;
import org.assertj.core.api.exception.RuntimeIOException;
import org.assertj.core.api.filter.FilterOperator;
import org.assertj.core.api.filter.Filters;
import org.assertj.core.api.filter.InFilter;
Expand Down Expand Up @@ -2206,7 +2206,7 @@ public static NotFilter not(Object valueNotToMatch) {
* @param charset the character set to use.
* @return the content of the file.
* @throws NullPointerException if the given charset is {@code null}.
* @throws RuntimeIOException if an I/O exception occurs.
* @throws UncheckedIOException if an I/O exception occurs.
*/
public static String contentOf(File file, Charset charset) {
return Files.contentOf(file, charset);
Expand All @@ -2223,7 +2223,7 @@ public static String contentOf(File file, Charset charset) {
* @param charsetName the name of the character set to use.
* @return the content of the file.
* @throws IllegalArgumentException if the given character set is not supported on this platform.
* @throws RuntimeIOException if an I/O exception occurs.
* @throws UncheckedIOException if an I/O exception occurs.
*/
public static String contentOf(File file, String charsetName) {
return Files.contentOf(file, charsetName);
Expand All @@ -2239,7 +2239,7 @@ public static String contentOf(File file, String charsetName) {
*
* @param file the file.
* @return the content of the file.
* @throws RuntimeIOException if an I/O exception occurs.
* @throws UncheckedIOException if an I/O exception occurs.
*/
public static String contentOf(File file) {
return Files.contentOf(file, Charset.defaultCharset());
Expand All @@ -2253,7 +2253,7 @@ public static String contentOf(File file) {
* @param file the file.
* @return the content of the file.
* @throws NullPointerException if the given charset is {@code null}.
* @throws RuntimeIOException if an I/O exception occurs.
* @throws UncheckedIOException if an I/O exception occurs.
*/
public static List<String> linesOf(File file) {
return Files.linesOf(file, Charset.defaultCharset());
Expand All @@ -2267,7 +2267,7 @@ public static List<String> linesOf(File file) {
* @param charset the character set to use.
* @return the content of the file.
* @throws NullPointerException if the given charset is {@code null}.
* @throws RuntimeIOException if an I/O exception occurs.
* @throws UncheckedIOException if an I/O exception occurs.
*/
public static List<String> linesOf(File file, Charset charset) {
return Files.linesOf(file, charset);
Expand All @@ -2281,7 +2281,7 @@ public static List<String> linesOf(File file, Charset charset) {
* @param charsetName the name of the character set to use.
* @return the content of the file.
* @throws NullPointerException if the given charset is {@code null}.
* @throws RuntimeIOException if an I/O exception occurs.
* @throws UncheckedIOException if an I/O exception occurs.
*/
public static List<String> linesOf(File file, String charsetName) {
return Files.linesOf(file, charsetName);
Expand All @@ -2301,7 +2301,7 @@ public static List<String> linesOf(File file, String charsetName) {
* @param charset the character set to use.
* @return the content of the URL.
* @throws NullPointerException if the given charset is {@code null}.
* @throws RuntimeIOException if an I/O exception occurs.
* @throws UncheckedIOException if an I/O exception occurs.
*/
public static String contentOf(URL url, Charset charset) {
return URLs.contentOf(url, charset);
Expand All @@ -2317,7 +2317,7 @@ public static String contentOf(URL url, Charset charset) {
* @param charsetName the name of the character set to use.
* @return the content of the URL.
* @throws IllegalArgumentException if the given character set is not supported on this platform.
* @throws RuntimeIOException if an I/O exception occurs.
* @throws UncheckedIOException if an I/O exception occurs.
*/
public static String contentOf(URL url, String charsetName) {
return URLs.contentOf(url, charsetName);
Expand All @@ -2332,7 +2332,7 @@ public static String contentOf(URL url, String charsetName) {
*
* @param url the URL.
* @return the content of the file.
* @throws RuntimeIOException if an I/O exception occurs.
* @throws UncheckedIOException if an I/O exception occurs.
*/
public static String contentOf(URL url) {
return URLs.contentOf(url, Charset.defaultCharset());
Expand All @@ -2346,7 +2346,7 @@ public static String contentOf(URL url) {
* @param url the URL.
* @return the content of the file.
* @throws NullPointerException if the given charset is {@code null}.
* @throws RuntimeIOException if an I/O exception occurs.
* @throws UncheckedIOException if an I/O exception occurs.
*/
public static List<String> linesOf(URL url) {
return URLs.linesOf(url, Charset.defaultCharset());
Expand All @@ -2360,7 +2360,7 @@ public static List<String> linesOf(URL url) {
* @param charset the character set to use.
* @return the content of the file.
* @throws NullPointerException if the given charset is {@code null}.
* @throws RuntimeIOException if an I/O exception occurs.
* @throws UncheckedIOException if an I/O exception occurs.
*/
public static List<String> linesOf(URL url, Charset charset) {
return URLs.linesOf(url, charset);
Expand All @@ -2374,7 +2374,7 @@ public static List<String> linesOf(URL url, Charset charset) {
* @param charsetName the name of the character set to use.
* @return the content of the file.
* @throws NullPointerException if the given charset is {@code null}.
* @throws RuntimeIOException if an I/O exception occurs.
* @throws UncheckedIOException if an I/O exception occurs.
*/
public static List<String> linesOf(URL url, String charsetName) {
return URLs.linesOf(url, charsetName);
Expand Down
26 changes: 13 additions & 13 deletions src/main/java/org/assertj/core/api/AssertionsForClassTypes.java
Expand Up @@ -16,6 +16,7 @@

import java.io.File;
import java.io.InputStream;
import java.io.UncheckedIOException;
import java.math.BigDecimal;
import java.net.URI;
import java.net.URL;
Expand All @@ -38,7 +39,6 @@
import java.util.concurrent.CompletableFuture;

import org.assertj.core.api.ThrowableAssert.ThrowingCallable;
import org.assertj.core.api.exception.RuntimeIOException;
import org.assertj.core.api.filter.FilterOperator;
import org.assertj.core.api.filter.Filters;
import org.assertj.core.api.filter.InFilter;
Expand Down Expand Up @@ -1444,7 +1444,7 @@ public static NotFilter not(Object valueNotToMatch) {
* @param charset the character set to use.
* @return the content of the file.
* @throws NullPointerException if the given charset is {@code null}.
* @throws RuntimeIOException if an I/O exception occurs.
* @throws UncheckedIOException if an I/O exception occurs.
*/
public static String contentOf(File file, Charset charset) {
return Files.contentOf(file, charset);
Expand All @@ -1461,7 +1461,7 @@ public static String contentOf(File file, Charset charset) {
* @param charsetName the name of the character set to use.
* @return the content of the file.
* @throws IllegalArgumentException if the given character set is not supported on this platform.
* @throws RuntimeIOException if an I/O exception occurs.
* @throws UncheckedIOException if an I/O exception occurs.
*/
public static String contentOf(File file, String charsetName) {
return Files.contentOf(file, charsetName);
Expand All @@ -1477,7 +1477,7 @@ public static String contentOf(File file, String charsetName) {
*
* @param file the file.
* @return the content of the file.
* @throws RuntimeIOException if an I/O exception occurs.
* @throws UncheckedIOException if an I/O exception occurs.
*/
public static String contentOf(File file) {
return Files.contentOf(file, Charset.defaultCharset());
Expand All @@ -1491,7 +1491,7 @@ public static String contentOf(File file) {
* @param file the file.
* @return the content of the file.
* @throws NullPointerException if the given charset is {@code null}.
* @throws RuntimeIOException if an I/O exception occurs.
* @throws UncheckedIOException if an I/O exception occurs.
*/
public static List<String> linesOf(File file) {
return Files.linesOf(file, Charset.defaultCharset());
Expand All @@ -1505,7 +1505,7 @@ public static List<String> linesOf(File file) {
* @param charset the character set to use.
* @return the content of the file.
* @throws NullPointerException if the given charset is {@code null}.
* @throws RuntimeIOException if an I/O exception occurs.
* @throws UncheckedIOException if an I/O exception occurs.
*/
public static List<String> linesOf(File file, Charset charset) {
return Files.linesOf(file, charset);
Expand All @@ -1519,7 +1519,7 @@ public static List<String> linesOf(File file, Charset charset) {
* @param charsetName the name of the character set to use.
* @return the content of the file.
* @throws NullPointerException if the given charset is {@code null}.
* @throws RuntimeIOException if an I/O exception occurs.
* @throws UncheckedIOException if an I/O exception occurs.
*/
public static List<String> linesOf(File file, String charsetName) {
return Files.linesOf(file, charsetName);
Expand All @@ -1539,7 +1539,7 @@ public static List<String> linesOf(File file, String charsetName) {
* @param charset the character set to use.
* @return the content of the URL.
* @throws NullPointerException if the given charset is {@code null}.
* @throws RuntimeIOException if an I/O exception occurs.
* @throws UncheckedIOException if an I/O exception occurs.
*/
public static String contentOf(URL url, Charset charset) {
return URLs.contentOf(url, charset);
Expand All @@ -1555,7 +1555,7 @@ public static String contentOf(URL url, Charset charset) {
* @param charsetName the name of the character set to use.
* @return the content of the URL.
* @throws IllegalArgumentException if the given character set is not supported on this platform.
* @throws RuntimeIOException if an I/O exception occurs.
* @throws UncheckedIOException if an I/O exception occurs.
*/
public static String contentOf(URL url, String charsetName) {
return URLs.contentOf(url, charsetName);
Expand All @@ -1570,7 +1570,7 @@ public static String contentOf(URL url, String charsetName) {
*
* @param url the URL.
* @return the content of the file.
* @throws RuntimeIOException if an I/O exception occurs.
* @throws UncheckedIOException if an I/O exception occurs.
*/
public static String contentOf(URL url) {
return URLs.contentOf(url, Charset.defaultCharset());
Expand All @@ -1584,7 +1584,7 @@ public static String contentOf(URL url) {
* @param url the URL.
* @return the content of the file.
* @throws NullPointerException if the given charset is {@code null}.
* @throws RuntimeIOException if an I/O exception occurs.
* @throws UncheckedIOException if an I/O exception occurs.
*/
public static List<String> linesOf(URL url) {
return URLs.linesOf(url, Charset.defaultCharset());
Expand All @@ -1598,7 +1598,7 @@ public static List<String> linesOf(URL url) {
* @param charset the character set to use.
* @return the content of the file.
* @throws NullPointerException if the given charset is {@code null}.
* @throws RuntimeIOException if an I/O exception occurs.
* @throws UncheckedIOException if an I/O exception occurs.
*/
public static List<String> linesOf(URL url, Charset charset) {
return URLs.linesOf(url, charset);
Expand All @@ -1612,7 +1612,7 @@ public static List<String> linesOf(URL url, Charset charset) {
* @param charsetName the name of the character set to use.
* @return the content of the file.
* @throws NullPointerException if the given charset is {@code null}.
* @throws RuntimeIOException if an I/O exception occurs.
* @throws UncheckedIOException if an I/O exception occurs.
*/
public static List<String> linesOf(URL url, String charsetName) {
return URLs.linesOf(url, charsetName);
Expand Down

0 comments on commit a901973

Please sign in to comment.