True if the argument is valid. False otherwise.
*/ public boolean testArgumentValue(String value) { - if (value.length() == 0) { + if (value.isEmpty()) { return !valueRequired; } if (valueRequired && value.startsWith("-")) { diff --git a/src/main/java/net/knarcraft/ffmpegconverter/utility/FFMpegHelper.java b/src/main/java/net/knarcraft/ffmpegconverter/utility/FFMpegHelper.java index acea9d3..1a8f863 100644 --- a/src/main/java/net/knarcraft/ffmpegconverter/utility/FFMpegHelper.java +++ b/src/main/java/net/knarcraft/ffmpegconverter/utility/FFMpegHelper.java @@ -110,7 +110,7 @@ public final class FFMpegHelper { StringBuilder output = new StringBuilder(); while (process.isAlive()) { String read = readProcess(processReader, spacer); - if (!read.equals("")) { + if (!read.isEmpty()) { if (write) { OutputUtil.println(read); } else { @@ -339,7 +339,7 @@ public final class FFMpegHelper { private static String readProcess(BufferedReader reader, String spacer) throws IOException { String line; StringBuilder text = new StringBuilder(); - while (reader.ready() && (line = reader.readLine()) != null && !line.equals("") && !line.equals("\n")) { + while (reader.ready() && (line = reader.readLine()) != null && !line.isEmpty() && !line.equals("\n")) { text.append(line).append(spacer); } return text.toString().trim(); diff --git a/src/main/java/net/knarcraft/ffmpegconverter/utility/OutputUtil.java b/src/main/java/net/knarcraft/ffmpegconverter/utility/OutputUtil.java index 71b1bbd..61d0e50 100644 --- a/src/main/java/net/knarcraft/ffmpegconverter/utility/OutputUtil.java +++ b/src/main/java/net/knarcraft/ffmpegconverter/utility/OutputUtil.java @@ -32,7 +32,7 @@ public final class OutputUtil { * @throws IOExceptionIf a write is not possible.
*/ public static void println(String input) throws IOException { - if (!input.equals("")) { + if (!input.isEmpty()) { writer.write(input); } println(); diff --git a/src/main/java/net/knarcraft/ffmpegconverter/utility/Parser.java b/src/main/java/net/knarcraft/ffmpegconverter/utility/Parser.java index f6999b7..a361299 100644 --- a/src/main/java/net/knarcraft/ffmpegconverter/utility/Parser.java +++ b/src/main/java/net/knarcraft/ffmpegconverter/utility/Parser.java @@ -193,7 +193,7 @@ public final class Parser { * @returnTrue if the string builder is non empty.
*/ private static boolean isNotEmpty(StringBuilder builder) { - return !builder.toString().trim().equals(""); + return !builder.toString().trim().isEmpty(); } } diff --git a/src/test/java/net/knarcraft/ffmpegconverter/converter/AnimeConverterTest.java b/src/test/java/net/knarcraft/ffmpegconverter/converter/AnimeConverterTest.java index 673f4f9..1ae1961 100644 --- a/src/test/java/net/knarcraft/ffmpegconverter/converter/AnimeConverterTest.java +++ b/src/test/java/net/knarcraft/ffmpegconverter/converter/AnimeConverterTest.java @@ -1,9 +1,6 @@ package net.knarcraft.ffmpegconverter.converter; import org.junit.Before; -import org.junit.Test; - -import static org.junit.Assert.assertEquals; public class AnimeConverterTest { @@ -14,9 +11,4 @@ public class AnimeConverterTest { false, -1, -1, ""); } - @Test - public void weirdTest() { - assertEquals(0, 0); - } - }