Skip to content

Commit 27d81bc

Browse files
committed
update maven dependencies
1 parent b345705 commit 27d81bc

2 files changed

Lines changed: 44 additions & 47 deletions

File tree

pom.xml

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -39,29 +39,24 @@
3939

4040
<dependencies>
4141
<dependency>
42-
<groupId>junit</groupId>
43-
<artifactId>junit</artifactId>
44-
<version>4.13.1</version>
45-
<scope>test</scope>
46-
</dependency>
47-
<dependency>
48-
<groupId>org.hamcrest</groupId>
49-
<artifactId>hamcrest-core</artifactId>
50-
<version>1.3</version>
42+
<groupId>org.junit.jupiter</groupId>
43+
<artifactId>junit-jupiter-api</artifactId>
44+
<version>5.10.3</version>
5145
<scope>test</scope>
5246
</dependency>
47+
5348
<dependency>
5449
<groupId>com.panayotis</groupId>
5550
<artifactId>jerminal</artifactId>
5651
<version>0.2.0</version>
5752
</dependency>
53+
5854
<dependency>
59-
<groupId>com.google.code.findbugs</groupId>
60-
<artifactId>jsr305</artifactId>
61-
<version>2.0.1</version>
62-
<type>jar</type>
63-
<scope>compile</scope>
55+
<groupId>com.github.spotbugs</groupId>
56+
<artifactId>spotbugs-annotations</artifactId>
57+
<version>4.8.6</version>
6458
</dependency>
59+
6560
</dependencies>
6661

6762
<scm>

src/test/java/com/panayotis/arjs/ArgsTest.java

Lines changed: 35 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,16 @@
55
*/
66
package com.panayotis.arjs;
77

8-
import org.junit.Test;
8+
9+
import org.junit.jupiter.api.Test;
910

1011
import java.util.List;
1112
import java.util.concurrent.atomic.AtomicBoolean;
1213
import java.util.concurrent.atomic.AtomicInteger;
1314
import java.util.concurrent.atomic.AtomicReference;
1415

15-
import static org.junit.Assert.*;
16+
import static org.junit.jupiter.api.Assertions.*;
17+
1618

1719
/**
1820
* @author teras
@@ -36,10 +38,10 @@ public void testJoinedAndCondensed() {
3638
args.setCondensed('/');
3739
args.setJoined(':');
3840
List<String> free = args.parse("/a", "/aa", "/aaasbbasa", "one", "two", "/s:three", "/b", "/a:another", "/s", "four", "/s:five", "/b");
39-
assertEquals("Condensed notation error with paramter /a,", (Integer) 8, mboolA.getValue());
40-
assertEquals("Condensed notation error with paramter /b,", (Integer) 4, mboolB.getValue());
41-
assertEquals("Multi string with condensed mode", "[one, two, three, four, five]", mstring.getValue().toString());
42-
assertEquals("A free parameter should exist, since /a is not a transitive parameter,", "[/a:another]", free.toString());
41+
assertEquals((Integer) 8, mboolA.getValue(), "Condensed notation error with paramter /a,");
42+
assertEquals((Integer) 4, mboolB.getValue(), "Condensed notation error with paramter /b,");
43+
assertEquals("[one, two, three, four, five]", mstring.getValue().toString(), "Multi string with condensed mode");
44+
assertEquals("[/a:another]", free.toString(), "A free parameter should exist, since /a is not a transitive parameter,");
4345
}
4446

4547
@Test
@@ -61,27 +63,27 @@ public void testArgs() {
6163
def("-D", mdefstring);
6264

6365
args.parse("something", "else");
64-
assertFalse("Default boolean should be false", bool.getValue());
65-
assertNull("Default String should be null", string.getValue());
66-
assertEquals("Default String with default,", "hey", defstring.getValue());
67-
assertEquals("Default multi bool,", (Integer) 0, mbool.getValue());
68-
assertTrue("Default multi String should be empty", mstring.getValue().isEmpty());
69-
assertTrue("Default multi String with default should contain 'hello' and 'hi'", mdefstring.getValue().size() == 2 && mdefstring.getValue().contains("hello") && mdefstring.getValue().contains("hi"));
66+
assertFalse(bool.getValue(), "Default boolean should be false");
67+
assertNull(string.getValue(), "Default String should be null");
68+
assertEquals("hey", defstring.getValue(), "Default String with default,");
69+
assertEquals((Integer) 0, mbool.getValue(), "Default multi bool,");
70+
assertTrue(mstring.getValue().isEmpty(), "Default multi String should be empty");
71+
assertTrue(mdefstring.getValue().size() == 2 && mdefstring.getValue().contains("hello") && mdefstring.getValue().contains("hi"), "Default multi String with default should contain 'hello' and 'hi'");
7072

7173
args.parse("something", "-b", "else", "-B", "-B", "-s", "one", "-d", "two", "-S", "S1", "-S", "S2", "-D", "D1");
72-
assertTrue("Boolean value defined and should be true", bool.getValue());
73-
assertEquals("Multi bool value appeared twice,", (Integer) 2, mbool.getValue());
74-
assertEquals("String argument,", "one", string.getValue());
75-
assertEquals("Default string argument,", "two", defstring.getValue());
76-
assertEquals("Multy String size,", 2, mstring.getValue().size());
77-
assertEquals("Default multy String size,", 3, mdefstring.getValue().size());
74+
assertTrue(bool.getValue(), "Boolean value defined and should be true");
75+
assertEquals((Integer) 2, mbool.getValue(), "Multi bool value appeared twice,");
76+
assertEquals("one", string.getValue(), "String argument,");
77+
assertEquals("two", defstring.getValue(), "Default string argument,");
78+
assertEquals(2, mstring.getValue().size(), "Multy String size,");
79+
assertEquals(3, mdefstring.getValue().size(), "Default multy String size,");
7880

7981
args.parse("-B", "-s", "three", "-S", "S3", "-S", "S4", "-D", "D2", "-D", "D3");
80-
assertEquals("String argument,", "three", string.getValue());
81-
assertEquals("Multy String size,", 4, mstring.getValue().size());
82-
assertEquals("Default multy String size,", 5, mdefstring.getValue().size());
83-
assertEquals("Multi String contents", "[S1, S2, S3, S4]", mstring.getValue().toString());
84-
assertEquals("Default multi String contents", "[hello, hi, D1, D2, D3]", mdefstring.getValue().toString());
82+
assertEquals("three", string.getValue(), "String argument,");
83+
assertEquals(4, mstring.getValue().size(), "Multy String size,");
84+
assertEquals(5, mdefstring.getValue().size(), "Default multy String size,");
85+
assertEquals("[S1, S2, S3, S4]", mstring.getValue().toString(), "Multi String contents");
86+
assertEquals("[hello, hi, D1, D2, D3]", mdefstring.getValue().toString(), "Default multi String contents");
8587
}
8688

8789
@Test
@@ -164,30 +166,30 @@ public void testParse() {
164166
args.parse();
165167

166168
args.parse("-h");
167-
assertTrue("Help argument not found", help.get());
169+
assertTrue(help.get(), "Help argument not found");
168170
System.out.println(error.get());
169171
assertNotNull("Should fail with missing argument", error.get());
170172

171173
reset(help, run, output, error, multi);
172174
args.parse("-o", "something", "--run");
173-
assertTrue("Wrong type of error, expected \"uniq\"", error.get() != null && error.get().contains("uniq"));
174-
assertTrue("Error should contain '[--output, --run]' ", error.get().contains("[--output, --run]"));
175+
assertTrue(error.get() != null && error.get().contains("uniq"), "Wrong type of error, expected \"uniq\"");
176+
assertTrue(error.get().contains("[--output, --run]"), "Error should contain '[--output, --run]' ");
175177

176178
reset(help, run, output, error, multi);
177179
rest2 = args.parse("-h", "-h", "unknown", "--help");
178-
assertFalse("Should fail with rest argument non existent", rest2.isEmpty());
179-
assertEquals("Size of missing arguments does not match", 1, rest2.size());
180-
assertEquals("Missing argument does not match", "unknown", rest2.get(0));
180+
assertFalse(rest2.isEmpty(), "Should fail with rest argument non existent");
181+
assertEquals(1, rest2.size(), "Size of missing arguments does not match");
182+
assertEquals("unknown", rest2.get(0), "Missing argument does not match");
181183

182184
reset(help, run, output, error, multi);
183185
args.parse("-h", "-o", "some", "--multi", "--multi");
184-
assertNull("No errors should be found", error.get());
185-
assertEquals("Output should be parsed", "some", output.get());
186-
assertEquals("Multiple parameter should be called twice", 2, multi.get());
186+
assertNull(error.get(), "No errors should be found");
187+
assertEquals("some", output.get(), "Output should be parsed");
188+
assertEquals(2, multi.get(), "Multiple parameter should be called twice");
187189

188190
reset(help, run, output, error, multi);
189191
args.parse("-h", "-h", "-o");
190-
assertTrue("Wrong type of error, expected \"Too few arguments\"", error.get() != null && error.get().contains("few"));
192+
assertTrue(error.get() != null && error.get().contains("few"), "Wrong type of error, expected \"Too few arguments\"");
191193
}
192194

193195
private void reset(AtomicBoolean help, AtomicBoolean run, AtomicReference<String> output, AtomicReference<String> error, AtomicInteger multi) {

0 commit comments

Comments
 (0)