Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Vogel2018-06-29 06:06:12 -0400
committerLars Vogel2018-07-02 06:45:20 -0400
commit5bf1ff45f9e26d792bf179bef4c729021c89a713 (patch)
treedd74676ce07e5b93653035c77947cc1bd265ff26
parentb8f98bcbf9b4c78be87d7853f4dca51d5e7c5713 (diff)
downloadeclipse.platform.team-5bf1ff45f9e26d792bf179bef4c729021c89a713.tar.gz
eclipse.platform.team-5bf1ff45f9e26d792bf179bef4c729021c89a713.tar.xz
eclipse.platform.team-5bf1ff45f9e26d792bf179bef4c729021c89a713.zip
Minor changes in LineReaderTest
Use static imports for assert statements and remove redundant catch block Change-Id: I81cfde09d60a39930a55facbd9c7c63644651039
-rw-r--r--tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/LineReaderTest.java24
1 files changed, 10 insertions, 14 deletions
diff --git a/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/LineReaderTest.java b/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/LineReaderTest.java
index 55756be6f..e46fad3f8 100644
--- a/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/LineReaderTest.java
+++ b/tests/org.eclipse.compare.tests/src/org/eclipse/compare/tests/LineReaderTest.java
@@ -11,14 +11,12 @@
package org.eclipse.compare.tests;
import java.io.*;
-import java.net.MalformedURLException;
import java.net.URL;
import java.util.List;
import org.eclipse.compare.internal.core.patch.LineReader;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
-import org.junit.Assert;
import junit.framework.TestCase;
@@ -27,16 +25,16 @@ public class LineReaderTest extends TestCase {
public void testReadEmpty() {
LineReader lr= new LineReader(getReader("empty.txt")); //$NON-NLS-1$
List<String> inLines= lr.readLines();
- Assert.assertEquals(0, inLines.size());
+ assertEquals(0, inLines.size());
}
public void testReadNormal() {
LineReader lr= new LineReader(getReader("normal.txt")); //$NON-NLS-1$
List<String> inLines= lr.readLines();
- Assert.assertEquals(3, inLines.size());
- Assert.assertEquals("[1]\n", convertLineDelimeters(inLines.get(0))); //$NON-NLS-1$
- Assert.assertEquals("[2]\n", convertLineDelimeters(inLines.get(1))); //$NON-NLS-1$
- Assert.assertEquals("[3]\n", convertLineDelimeters(inLines.get(2))); //$NON-NLS-1$
+ assertEquals(3, inLines.size());
+ assertEquals("[1]\n", convertLineDelimeters(inLines.get(0))); //$NON-NLS-1$
+ assertEquals("[2]\n", convertLineDelimeters(inLines.get(1))); //$NON-NLS-1$
+ assertEquals("[3]\n", convertLineDelimeters(inLines.get(2))); //$NON-NLS-1$
}
private String convertLineDelimeters(Object object) {
@@ -49,10 +47,10 @@ public class LineReaderTest extends TestCase {
public void testReadUnterminatedLastLine() {
LineReader lr= new LineReader(getReader("unterminated.txt")); //$NON-NLS-1$
List<String> inLines= lr.readLines();
- Assert.assertEquals(3, inLines.size());
- Assert.assertEquals("[1]\n", convertLineDelimeters(inLines.get(0))); //$NON-NLS-1$
- Assert.assertEquals("[2]\n", convertLineDelimeters(inLines.get(1))); //$NON-NLS-1$
- Assert.assertEquals("[3]", inLines.get(2)); //$NON-NLS-1$
+ assertEquals(3, inLines.size());
+ assertEquals("[1]\n", convertLineDelimeters(inLines.get(0))); //$NON-NLS-1$
+ assertEquals("[2]\n", convertLineDelimeters(inLines.get(1))); //$NON-NLS-1$
+ assertEquals("[3]", inLines.get(2)); //$NON-NLS-1$
}
private BufferedReader getReader(String name) {
@@ -63,9 +61,7 @@ public class LineReaderTest extends TestCase {
InputStream resourceAsStream = url.openStream();
InputStreamReader reader2 = new InputStreamReader(resourceAsStream);
return new BufferedReader(reader2);
- } catch (MalformedURLException e) {
- fail(e.getMessage());
- } catch (IOException e) {
+ } catch ( IOException e) {
fail(e.getMessage());
}
return null;

Back to the top