Skip to content

Commit fb7fca6

Browse files
committed
fixes #69
1 parent 94ffdab commit fb7fca6

File tree

15 files changed

+92
-114
lines changed

15 files changed

+92
-114
lines changed

java-diff-utils-jgit/pom.xml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,11 @@
1010
<name>java-diff-utils-jgit</name>
1111
<packaging>jar</packaging>
1212
<description>This is an extension of java-diff-utils using jgit to use its implementation of
13-
some difference algorithms.</description>
13+
some difference algorithms.</description>
1414
<dependencies>
1515
<dependency>
16-
<groupId>junit</groupId>
17-
<artifactId>junit</artifactId>
18-
<version>4.12</version>
19-
<type>jar</type>
16+
<groupId>org.junit.jupiter</groupId>
17+
<artifactId>junit-jupiter</artifactId>
2018
<scope>test</scope>
2119
</dependency>
2220
<dependency>

java-diff-utils-jgit/src/test/java/com/github/difflib/algorithm/jgit/HistogramDiffTest.java

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,9 @@
2121
import java.util.ArrayList;
2222
import java.util.Arrays;
2323
import java.util.List;
24-
import org.junit.After;
25-
import org.junit.AfterClass;
26-
import static org.junit.Assert.*;
27-
import org.junit.Before;
28-
import org.junit.BeforeClass;
29-
import org.junit.Test;
24+
import static org.junit.jupiter.api.Assertions.assertEquals;
25+
import static org.junit.jupiter.api.Assertions.assertNotNull;
26+
import org.junit.jupiter.api.Test;
3027

3128
/**
3229
*
@@ -37,22 +34,6 @@ public class HistogramDiffTest {
3734
public HistogramDiffTest() {
3835
}
3936

40-
@BeforeClass
41-
public static void setUpClass() {
42-
}
43-
44-
@AfterClass
45-
public static void tearDownClass() {
46-
}
47-
48-
@Before
49-
public void setUp() {
50-
}
51-
52-
@After
53-
public void tearDown() {
54-
}
55-
5637
/**
5738
* Test of diff method, of class HistogramDiff.
5839
*/

java-diff-utils-jgit/src/test/java/com/github/difflib/algorithm/jgit/LRHistogramDiffTest.java

Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -28,38 +28,16 @@
2828
import java.util.List;
2929
import static java.util.stream.Collectors.toList;
3030
import java.util.zip.ZipFile;
31-
import org.junit.After;
32-
import org.junit.AfterClass;
33-
import static org.junit.Assert.*;
34-
import org.junit.Before;
35-
import org.junit.BeforeClass;
36-
import org.junit.Test;
31+
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
32+
import static org.junit.jupiter.api.Assertions.assertEquals;
33+
import org.junit.jupiter.api.Test;
3734

3835
/**
3936
*
4037
* @author toben
4138
*/
4239
public class LRHistogramDiffTest {
4340

44-
public LRHistogramDiffTest() {
45-
}
46-
47-
@BeforeClass
48-
public static void setUpClass() {
49-
}
50-
51-
@AfterClass
52-
public static void tearDownClass() {
53-
}
54-
55-
@Before
56-
public void setUp() {
57-
}
58-
59-
@After
60-
public void tearDown() {
61-
}
62-
6341
@Test
6442
public void testPossibleDiffHangOnLargeDatasetDnaumenkoIssue26() throws IOException, PatchFailedException {
6543
ZipFile zip = new ZipFile("target/test-classes/mocks/large_dataset1.zip");

java-diff-utils/pom.xml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,13 @@
1515

1616
<dependencies>
1717
<dependency>
18-
<groupId>junit</groupId>
19-
<artifactId>junit</artifactId>
20-
<version>4.12</version>
21-
<type>jar</type>
18+
<groupId>org.junit.jupiter</groupId>
19+
<artifactId>junit-jupiter</artifactId>
2220
<scope>test</scope>
2321
</dependency>
2422
<dependency>
2523
<groupId>org.assertj</groupId>
2624
<artifactId>assertj-core</artifactId>
27-
<version>3.11.1</version>
2825
<scope>test</scope>
2926
</dependency>
3027
</dependencies>

java-diff-utils/src/main/java/com/github/difflib/text/DiffRowGenerator.java

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,10 @@
3232
import static java.util.stream.Collectors.toList;
3333

3434
/**
35-
* This class for generating DiffRows for side-by-sidy view. You can customize the way of generating. For example, show
36-
* inline diffs on not, ignoring white spaces or/and blank lines and so on. All parameters for generating are optional.
37-
* If you do not specify them, the class will use the default values.
35+
* This class for generating DiffRows for side-by-sidy view. You can customize the way of
36+
* generating. For example, show inline diffs on not, ignoring white spaces or/and blank lines and
37+
* so on. All parameters for generating are optional. If you do not specify them, the class will use
38+
* the default values.
3839
*
3940
* These values are: showInlineDiffs = false; ignoreWhiteSpaces = true; ignoreBlankLines = true; ...
4041
*
@@ -52,7 +53,6 @@ public final class DiffRowGenerator {
5253

5354
public static final Function<String, String> LINE_NORMALIZER_FOR_HTML = StringUtils::normalize;
5455

55-
5656
/**
5757
* Splitting lines by character to achieve char by char diff checking.
5858
*/
@@ -101,7 +101,8 @@ protected final static List<String> splitStringPreserveDelimiter(String str, Pat
101101
/**
102102
* Wrap the elements in the sequence with the given tag
103103
*
104-
* @param startPosition the position from which tag should start. The counting start from a zero.
104+
* @param startPosition the position from which tag should start. The counting start from a
105+
* zero.
105106
* @param endPosition the position before which tag should should be closed.
106107
* @param tagGenerator the tag generator
107108
*/
@@ -170,8 +171,8 @@ private DiffRowGenerator(Builder builder) {
170171
}
171172

172173
/**
173-
* Get the DiffRows describing the difference between original and revised texts using the given patch. Useful for
174-
* displaying side-by-side diff.
174+
* Get the DiffRows describing the difference between original and revised texts using the given
175+
* patch. Useful for displaying side-by-side diff.
175176
*
176177
* @param original the original text
177178
* @param revised the revised text
@@ -182,8 +183,8 @@ public List<DiffRow> generateDiffRows(List<String> original, List<String> revise
182183
}
183184

184185
/**
185-
* Generates the DiffRows describing the difference between original and revised texts using the given patch. Useful
186-
* for displaying side-by-side diff.
186+
* Generates the DiffRows describing the difference between original and revised texts using the
187+
* given patch. Useful for displaying side-by-side diff.
187188
*
188189
* @param original the original text
189190
* @param patch the given patch
@@ -402,8 +403,8 @@ public Builder ignoreWhiteSpaces(boolean val) {
402403
}
403404

404405
/**
405-
* Give the originial old and new text lines to Diffrow without any additional processing and without any tags to
406-
* highlight the change.
406+
* Give the originial old and new text lines to Diffrow without any additional processing
407+
* and without any tags to highlight the change.
407408
*
408409
* @param val the value to set. Default: false.
409410
* @return builder with configured reportLinesUnWrapped parameter
@@ -438,8 +439,8 @@ public Builder newTag(Function<Boolean, String> generator) {
438439
/**
439440
* Set the column width of generated lines of original and revised texts.
440441
*
441-
* @param width the width to set. Making it < 0 doesn't have any sense. Default 80. @return builder with config
442-
* ured ignoreBlankLines parameter
442+
* @param width the width to set. Making it < 0 doesn't have any sense. Default 80. @return
443+
* builder with config ured ignoreBlankLines parameter
443444
*/
444445
public Builder columnWidth(int width) {
445446
if (width >= 0) {
@@ -458,7 +459,8 @@ public DiffRowGenerator build() {
458459
}
459460

460461
/**
461-
* Merge the complete result within the original text. This makes sense for one line display.
462+
* Merge the complete result within the original text. This makes sense for one line
463+
* display.
462464
*
463465
* @param mergeOriginalRevised
464466
* @return
@@ -469,8 +471,9 @@ public Builder mergeOriginalRevised(boolean mergeOriginalRevised) {
469471
}
470472

471473
/**
472-
* Per default each character is separatly processed. This variant introduces processing by word, which does not
473-
* deliver in word changes. Therefore the whole word will be tagged as changed:
474+
* Per default each character is separatly processed. This variant introduces processing by
475+
* word, which does not deliver in word changes. Therefore the whole word will be tagged as
476+
* changed:
474477
*
475478
* <pre>
476479
* false: (aBa : aba) -- changed: a(B)a : a(b)a
@@ -483,8 +486,8 @@ public Builder inlineDiffByWord(boolean inlineDiffByWord) {
483486
}
484487

485488
/**
486-
* To provide some customized splitting a splitter can be provided. Here someone could think about sentence splitter,
487-
* comma splitter or stuff like that.
489+
* To provide some customized splitting a splitter can be provided. Here someone could think
490+
* about sentence splitter, comma splitter or stuff like that.
488491
*
489492
* @param inlineDiffSplitter
490493
* @return
@@ -495,8 +498,9 @@ public Builder inlineDiffBySplitter(Function<String, List<String>> inlineDiffSpl
495498
}
496499

497500
/**
498-
* By default DiffRowGenerator preprocesses lines for HTML output. Tabs and special HTML characters like "&lt;"
499-
* are replaced with its encoded value. To change this you can provide a customized line normalizer here.
501+
* By default DiffRowGenerator preprocesses lines for HTML output. Tabs and special HTML
502+
* characters like "&lt;" are replaced with its encoded value. To change this you can
503+
* provide a customized line normalizer here.
500504
*
501505
* @param lineNormalizer
502506
* @return

java-diff-utils/src/test/java/com/github/difflib/DiffUtilsTest.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@
1919
import java.util.List;
2020
import static java.util.stream.Collectors.toList;
2121
import java.util.zip.ZipFile;
22-
import static org.junit.Assert.assertEquals;
23-
import static org.junit.Assert.assertNotNull;
24-
import static org.junit.Assert.assertTrue;
25-
import org.junit.Ignore;
26-
import org.junit.Test;
22+
import static org.junit.jupiter.api.Assertions.assertEquals;
23+
import static org.junit.jupiter.api.Assertions.assertNotNull;
24+
import static org.junit.jupiter.api.Assertions.assertTrue;
25+
import org.junit.jupiter.api.Disabled;
26+
import org.junit.jupiter.api.Test;
2727

2828
public class DiffUtilsTest {
2929

@@ -134,7 +134,7 @@ public void testDiffMissesChangeForkDnaumenkoIssue31() throws DiffException {
134134
* To test this, the greedy meyer algorithm is not suitable.
135135
*/
136136
@Test
137-
@Ignore
137+
@Disabled
138138
public void testPossibleDiffHangOnLargeDatasetDnaumenkoIssue26() throws IOException, DiffException {
139139
ZipFile zip = new ZipFile(TestConstants.MOCK_FOLDER + "/large_dataset1.zip");
140140

java-diff-utils/src/test/java/com/github/difflib/GenerateUnifiedDiffTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
import java.util.Arrays;
1212
import java.util.List;
1313
import static java.util.stream.Collectors.joining;
14-
import static org.junit.Assert.assertEquals;
15-
import static org.junit.Assert.fail;
16-
import org.junit.Test;
14+
import static org.junit.jupiter.api.Assertions.assertEquals;
15+
import static org.junit.jupiter.api.Assertions.fail;
16+
import org.junit.jupiter.api.Test;
1717

1818
public class GenerateUnifiedDiffTest {
1919

java-diff-utils/src/test/java/com/github/difflib/algorithm/myers/MyersDiffTest.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,9 @@
2121
import java.util.ArrayList;
2222
import java.util.Arrays;
2323
import java.util.List;
24-
import static org.junit.Assert.*;
25-
import org.junit.Test;
24+
import static org.junit.jupiter.api.Assertions.assertEquals;
25+
import static org.junit.jupiter.api.Assertions.assertNotNull;
26+
import org.junit.jupiter.api.Test;
2627

2728
/**
2829
*

java-diff-utils/src/test/java/com/github/difflib/patch/PatchTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
import com.github.difflib.algorithm.DiffException;
55
import java.util.Arrays;
66
import java.util.List;
7-
import static org.junit.Assert.assertEquals;
8-
import static org.junit.Assert.fail;
9-
import org.junit.Test;
7+
import static org.junit.jupiter.api.Assertions.assertEquals;
8+
import static org.junit.jupiter.api.Assertions.fail;
9+
import org.junit.jupiter.api.Test;
1010

1111
public class PatchTest {
1212

java-diff-utils/src/test/java/com/github/difflib/text/DiffRowGeneratorTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
import java.util.List;
1010
import java.util.regex.Pattern;
1111
import static java.util.stream.Collectors.toList;
12-
import static org.junit.Assert.assertEquals;
13-
import static org.junit.Assert.assertTrue;
14-
import org.junit.Test;
12+
import static org.junit.jupiter.api.Assertions.assertEquals;
13+
import static org.junit.jupiter.api.Assertions.assertTrue;
14+
import org.junit.jupiter.api.Test;
1515

1616
public class DiffRowGeneratorTest {
1717

java-diff-utils/src/test/java/com/github/difflib/text/StringUtilsTest.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@
1515
*/
1616
package com.github.difflib.text;
1717

18-
import static org.junit.Assert.*;
19-
import org.junit.Test;
18+
import org.junit.jupiter.api.Assertions;
19+
import static org.junit.jupiter.api.Assertions.assertEquals;
20+
import org.junit.jupiter.api.Test;
2021

2122
/**
2223
*
@@ -50,9 +51,10 @@ public void testWrapText_String_int() {
5051
assertEquals("test", StringUtils.wrapText("test", 10));
5152
}
5253

53-
@Test(expected = IllegalArgumentException.class)
54+
@Test
5455
public void testWrapText_String_int_zero() {
55-
assertEquals("test", StringUtils.wrapText("test", -1));
56+
Assertions.assertThrows(IllegalArgumentException.class,
57+
() -> StringUtils.wrapText("test", -1));
5658
}
5759

5860
}

java-diff-utils/src/test/java/com/github/difflib/unifieddiff/UnifiedDiffReaderTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@
1919
import java.io.IOException;
2020
import java.util.regex.Matcher;
2121
import java.util.regex.Pattern;
22-
import static org.assertj.core.api.Java6Assertions.assertThat;
23-
import static org.junit.Assert.assertEquals;
24-
import static org.junit.Assert.assertTrue;
25-
import org.junit.Test;
22+
import static org.assertj.core.api.Assertions.assertThat;
23+
import static org.junit.jupiter.api.Assertions.assertEquals;
24+
import static org.junit.jupiter.api.Assertions.assertTrue;
25+
import org.junit.jupiter.api.Test;
2626

2727
/**
2828
*

java-diff-utils/src/test/java/com/github/difflib/unifieddiff/UnifiedDiffRoundTripTest.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@
1515
import java.util.Arrays;
1616
import java.util.List;
1717
import static java.util.stream.Collectors.joining;
18-
import static org.junit.Assert.assertEquals;
19-
import static org.junit.Assert.fail;
20-
import org.junit.Ignore;
21-
import org.junit.Test;
18+
import static org.junit.jupiter.api.Assertions.assertEquals;
19+
import static org.junit.jupiter.api.Assertions.fail;
20+
import org.junit.jupiter.api.Disabled;
21+
import org.junit.jupiter.api.Test;
2222

2323
public class UnifiedDiffRoundTripTest {
2424

@@ -84,7 +84,7 @@ public void testDiff_Issue10() throws IOException {
8484
* Issue 12
8585
*/
8686
@Test
87-
@Ignore
87+
@Disabled
8888
public void testPatchWithNoDeltas() throws DiffException, IOException {
8989
final List<String> lines1 = fileToLines(TestConstants.MOCK_FOLDER + "issue11_1.txt");
9090
final List<String> lines2 = fileToLines(TestConstants.MOCK_FOLDER + "issue11_2.txt");

java-diff-utils/src/test/java/com/github/difflib/unifieddiff/UnifiedDiffWriterTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@
2929
import java.util.ArrayList;
3030
import java.util.Collections;
3131
import java.util.List;
32-
import static org.junit.Assert.assertEquals;
33-
import org.junit.Test;
32+
import static org.junit.jupiter.api.Assertions.assertEquals;
33+
import org.junit.jupiter.api.Test;
3434

3535
/**
3636
*

0 commit comments

Comments
 (0)