Skip to content

Commit

Permalink
Switch to junit 5
Browse files Browse the repository at this point in the history
  • Loading branch information
gnodet committed Oct 3, 2023
1 parent a2ab047 commit 8e8540d
Show file tree
Hide file tree
Showing 74 changed files with 301 additions and 297 deletions.
4 changes: 2 additions & 2 deletions builtins/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@
</dependency>

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
4 changes: 2 additions & 2 deletions builtins/src/test/java/org/jline/builtins/CommandsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
import org.jline.terminal.Size;
import org.jline.terminal.Terminal;
import org.jline.terminal.TerminalBuilder;
import org.junit.Test;
import org.junit.jupiter.api.Test;

import static org.junit.Assert.assertEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;

public class CommandsTest {
@Test
Expand Down
4 changes: 2 additions & 2 deletions builtins/src/test/java/org/jline/builtins/CompletersTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
import org.jline.reader.LineReader;
import org.jline.reader.ParsedLine;
import org.jline.reader.impl.DefaultParser;
import org.junit.Test;
import org.junit.jupiter.api.Test;

import static org.jline.builtins.Completers.TreeCompleter.node;
import static org.junit.Assert.assertEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;

public class CompletersTest {

Expand Down
8 changes: 4 additions & 4 deletions builtins/src/test/java/org/jline/builtins/InputRCTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
import org.jline.reader.Macro;
import org.jline.reader.Reference;
import org.jline.terminal.TerminalBuilder;
import org.junit.Test;
import org.junit.jupiter.api.Test;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull;

public class InputRCTest {

Expand Down
6 changes: 4 additions & 2 deletions builtins/src/test/java/org/jline/builtins/NanoTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,13 @@
import org.jline.keymap.KeyMap;
import org.jline.terminal.Size;
import org.jline.terminal.impl.LineDisciplineTerminal;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.Timeout;

public class NanoTest {

@Test(timeout = 1000)
@Test
@Timeout(1)
public void nanoBufferLineOverflow() throws Exception {
ByteArrayOutputStream output = new ByteArrayOutputStream();
LineDisciplineTerminal terminal = new LineDisciplineTerminal("nano", "xterm", output, StandardCharsets.UTF_8);
Expand Down
8 changes: 4 additions & 4 deletions builtins/src/test/java/org/jline/builtins/NfaMatcherTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
import java.util.HashSet;
import java.util.Set;

import org.junit.Test;
import org.junit.jupiter.api.Test;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;

public class NfaMatcherTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import org.jline.reader.impl.completer.ArgumentCompleter;
import org.jline.reader.impl.completer.NullCompleter;
import org.jline.reader.impl.completer.StringsCompleter;
import org.junit.Test;
import org.junit.jupiter.api.Test;

public class OptionCompleterTest extends ReaderTestSupport {

Expand Down
8 changes: 4 additions & 4 deletions builtins/src/test/java/org/jline/builtins/OptionsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@
import org.jline.terminal.Terminal;
import org.jline.terminal.TerminalBuilder;
import org.jline.utils.AttributedString;
import org.junit.Test;
import org.junit.jupiter.api.Test;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;

public class OptionsTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
import org.jline.terminal.impl.DumbTerminal;
import org.jline.utils.Curses;
import org.jline.utils.InfoCmp.Capability;
import org.junit.Before;
import org.junit.jupiter.api.BeforeEach;

import static org.jline.reader.LineReader.ACCEPT_LINE;
import static org.jline.reader.LineReader.BACKWARD_CHAR;
Expand All @@ -47,8 +47,8 @@
import static org.jline.reader.LineReader.UP_HISTORY;
import static org.jline.reader.LineReader.YANK;
import static org.jline.reader.LineReader.YANK_POP;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;

/**
* Provides support for reader tests.
Expand All @@ -60,7 +60,7 @@ public abstract class ReaderTestSupport {
protected ByteArrayOutputStream out;
protected Character mask;

@Before
@BeforeEach
public void setUp() throws Exception {
Handler ch = new ConsoleHandler();
ch.setLevel(Level.FINEST);
Expand Down
15 changes: 9 additions & 6 deletions builtins/src/test/java/org/jline/builtins/StylesTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@
*/
package org.jline.builtins;

import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.Timeout;

import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;

public class StylesTest {
private static final int TIMEOUT = 1000;
private static final int TIMEOUT = 1;

private static final String STANDARD_COLORS = "di=1;91:ex=1;92:ln=1;96:fi=";

Expand All @@ -33,7 +34,8 @@ public void testIsStylePatternStandardColors() {
assertTrue(stylePattern);
}

@Test(timeout = TIMEOUT)
@Test
@Timeout(TIMEOUT)
public void testIsStylePatternRepeatedDirectory() {
final StringBuilder builder = getRepeatedStyleBuilder();

Expand All @@ -43,7 +45,8 @@ public void testIsStylePatternRepeatedDirectory() {
assertTrue(stylePattern);
}

@Test(timeout = TIMEOUT)
@Test
@Timeout(TIMEOUT)
public void testIsStylePatternAsteriskTilde() {
final StringBuilder builder = getRepeatedStyleBuilder();
builder.append(ASTERISK_TILDE_STYLE_ELEMENT);
Expand Down
6 changes: 3 additions & 3 deletions builtins/src/test/java/org/jline/builtins/TmuxTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
*/
package org.jline.builtins;

import org.junit.Test;
import org.junit.jupiter.api.Test;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;

public class TmuxTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

import org.jline.builtins.Completers.TreeCompleter;
import org.jline.reader.LineReader;
import org.junit.Test;
import org.junit.jupiter.api.Test;

import static org.jline.builtins.Completers.TreeCompleter.node;

Expand Down
4 changes: 2 additions & 2 deletions console/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@
</dependency>

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
4 changes: 2 additions & 2 deletions groovy/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@
<optional>true</optional>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
4 changes: 1 addition & 3 deletions native/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,12 @@
<dependencies>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>5.7.0</version>
<artifactId>junit-jupiter-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId>
<version>5.7.0</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
12 changes: 9 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
<juniversalchardet.version>1.0.3</juniversalchardet.version>
<sshd.version>2.9.2</sshd.version>
<easymock.version>5.1.0</easymock.version>
<junit.version>4.13.2</junit.version>
<junit.version>5.10.0</junit.version>
<gogo.runtime.version>1.1.6</gogo.runtime.version>
<gogo.jline.version>1.1.8</gogo.jline.version>
<slf4j.version>2.0.6</slf4j.version>
Expand Down Expand Up @@ -294,10 +294,16 @@
</dependency>

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>${junit.version}</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>com.google.code.findbugs</groupId>
Expand Down
4 changes: 2 additions & 2 deletions reader/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
</dependency>

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
10 changes: 5 additions & 5 deletions reader/src/test/java/org/jline/keymap/BindingReaderTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,19 @@
import org.jline.terminal.Size;
import org.jline.terminal.Terminal;
import org.jline.terminal.impl.DumbTerminal;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNull;

public class BindingReaderTest {

protected Terminal terminal;
protected EofPipedInputStream in;
protected ByteArrayOutputStream out;

@Before
@BeforeEach
public void setUp() throws Exception {
Handler ch = new ConsoleHandler();
ch.setLevel(Level.FINEST);
Expand Down
13 changes: 6 additions & 7 deletions reader/src/test/java/org/jline/keymap/KeyMapTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,8 @@
import org.jline.terminal.Size;
import org.jline.terminal.Terminal;
import org.jline.terminal.impl.DumbTerminal;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import static org.jline.keymap.KeyMap.alt;
import static org.jline.keymap.KeyMap.display;
Expand All @@ -41,16 +40,16 @@
import static org.jline.reader.LineReader.KILL_WHOLE_LINE;
import static org.jline.reader.LineReader.SEND_BREAK;
import static org.jline.reader.LineReader.UP_HISTORY;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNull;

public class KeyMapTest {

protected Terminal terminal;
protected EofPipedInputStream in;
protected ByteArrayOutputStream out;

@Before
@BeforeEach
public void setUp() throws Exception {
Handler ch = new ConsoleHandler();
ch.setLevel(Level.FINEST);
Expand All @@ -69,7 +68,7 @@ public void setUp() throws Exception {
public void testBound() throws Exception {
KeyMap<Binding> map = new LineReaderImpl(terminal).emacs();

Assert.assertEquals(new Reference(COMPLETE_WORD), map.getBound("\u001B\u001B"));
assertEquals(new Reference(COMPLETE_WORD), map.getBound("\u001B\u001B"));
assertEquals(new Reference(BACKWARD_WORD), map.getBound(alt("b")));

map.bindIfNotBound(new Reference(UP_HISTORY), "\033[0A");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@

import org.jline.terminal.Terminal;
import org.jline.terminal.TerminalBuilder;
import org.junit.Test;
import org.junit.jupiter.api.Test;

import static org.junit.Assert.assertEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;

public class LineReaderBuilderTest {

Expand All @@ -26,7 +26,7 @@ public void testInheritAppNameFromTerminal() throws IOException {
final LineReader lineReader =
LineReaderBuilder.builder().terminal(terminal).build();

assertEquals("Did not inherit appName from terminal", expectedAppName, lineReader.getAppName());
assertEquals(expectedAppName, lineReader.getAppName(), "Did not inherit appName from terminal");
}

@Test
Expand All @@ -39,6 +39,6 @@ public void testPreferAppNameFromBuilder() throws IOException {
.terminal(terminal)
.build();

assertEquals("Did not prefer appName from builder", expectedAppName, lineReader.getAppName());
assertEquals(expectedAppName, lineReader.getAppName(), "Did not prefer appName from builder");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import org.jline.reader.impl.ReaderTestSupport;
import org.jline.reader.impl.completer.ArgumentCompleter;
import org.jline.reader.impl.completer.StringsCompleter;
import org.junit.Test;
import org.junit.jupiter.api.Test;

/**
* Tests for {@link ArgumentCompleter}.
Expand Down
Loading

0 comments on commit 8e8540d

Please sign in to comment.