Skip to content

Commit 7256ed3

Browse files
authored
Merge pull request #506 from lutovich/1.7-simple-tests-to-junit5
Migrate simple unit tests to JUnit 5
2 parents dcaf1ea + 4e90bde commit 7256ed3

File tree

103 files changed

+2058
-3382
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

103 files changed

+2058
-3382
lines changed

driver/src/test/java/org/neo4j/driver/internal/BookmarkTest.java

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
*/
1919
package org.neo4j.driver.internal;
2020

21-
import org.junit.Test;
21+
import org.junit.jupiter.api.Test;
2222

2323
import java.util.Collections;
2424
import java.util.HashMap;
@@ -29,73 +29,73 @@
2929

3030
import static java.util.Arrays.asList;
3131
import static java.util.Collections.emptyMap;
32-
import static org.junit.Assert.assertEquals;
33-
import static org.junit.Assert.assertFalse;
34-
import static org.junit.Assert.assertNull;
35-
import static org.junit.Assert.assertTrue;
32+
import static org.junit.jupiter.api.Assertions.assertEquals;
33+
import static org.junit.jupiter.api.Assertions.assertFalse;
34+
import static org.junit.jupiter.api.Assertions.assertNull;
35+
import static org.junit.jupiter.api.Assertions.assertTrue;
3636
import static org.neo4j.driver.v1.Values.value;
3737

38-
public class BookmarkTest
38+
class BookmarkTest
3939
{
4040
@Test
41-
public void isEmptyForEmptyBookmark()
41+
void isEmptyForEmptyBookmark()
4242
{
4343
Bookmark bookmark = Bookmark.empty();
4444
assertTrue( bookmark.isEmpty() );
4545
}
4646

4747
@Test
48-
public void maxBookmarkAsStringForEmptyBookmark()
48+
void maxBookmarkAsStringForEmptyBookmark()
4949
{
5050
Bookmark bookmark = Bookmark.empty();
5151
assertNull( bookmark.maxBookmarkAsString() );
5252
}
5353

5454
@Test
55-
public void asBeginTransactionParametersForEmptyBookmark()
55+
void asBeginTransactionParametersForEmptyBookmark()
5656
{
5757
Bookmark bookmark = Bookmark.empty();
5858
assertEquals( emptyMap(), bookmark.asBeginTransactionParameters() );
5959
}
6060

6161
@Test
62-
public void isEmptyForNonEmptyBookmark()
62+
void isEmptyForNonEmptyBookmark()
6363
{
6464
Bookmark bookmark = Bookmark.from( "SomeBookmark" );
6565
assertFalse( bookmark.isEmpty() );
6666
}
6767

6868
@Test
69-
public void maxBookmarkAsStringForNonEmptyBookmark()
69+
void maxBookmarkAsStringForNonEmptyBookmark()
7070
{
7171
Bookmark bookmark = Bookmark.from( "SomeBookmark" );
7272
assertEquals( "SomeBookmark", bookmark.maxBookmarkAsString() );
7373
}
7474

7575
@Test
76-
public void asBeginTransactionParametersForNonEmptyBookmark()
76+
void asBeginTransactionParametersForNonEmptyBookmark()
7777
{
7878
Bookmark bookmark = Bookmark.from( "SomeBookmark" );
7979
verifyParameters( bookmark, "SomeBookmark", "SomeBookmark" );
8080
}
8181

8282
@Test
83-
public void bookmarkFromString()
83+
void bookmarkFromString()
8484
{
8585
Bookmark bookmark = Bookmark.from( "Cat" );
8686
assertEquals( "Cat", bookmark.maxBookmarkAsString() );
8787
verifyParameters( bookmark, "Cat", "Cat" );
8888
}
8989

9090
@Test
91-
public void bookmarkFromNullString()
91+
void bookmarkFromNullString()
9292
{
9393
Bookmark bookmark = Bookmark.from( (String) null );
9494
assertTrue( bookmark.isEmpty() );
9595
}
9696

9797
@Test
98-
public void bookmarkFromIterable()
98+
void bookmarkFromIterable()
9999
{
100100
Bookmark bookmark = Bookmark.from( asList(
101101
"neo4j:bookmark:v1:tx42", "neo4j:bookmark:v1:tx10", "neo4j:bookmark:v1:tx12" ) );
@@ -106,21 +106,21 @@ public void bookmarkFromIterable()
106106
}
107107

108108
@Test
109-
public void bookmarkFromNullIterable()
109+
void bookmarkFromNullIterable()
110110
{
111111
Bookmark bookmark = Bookmark.from( (Iterable<String>) null );
112112
assertTrue( bookmark.isEmpty() );
113113
}
114114

115115
@Test
116-
public void bookmarkFromEmptyIterable()
116+
void bookmarkFromEmptyIterable()
117117
{
118118
Bookmark bookmark = Bookmark.from( Collections.<String>emptyList() );
119119
assertTrue( bookmark.isEmpty() );
120120
}
121121

122122
@Test
123-
public void asBeginTransactionParametersForBookmarkWithInvalidValue()
123+
void asBeginTransactionParametersForBookmarkWithInvalidValue()
124124
{
125125
Bookmark bookmark = Bookmark.from( asList(
126126
"neo4j:bookmark:v1:tx1", "neo4j:bookmark:v1:txcat", "neo4j:bookmark:v1:tx3" ) );
@@ -131,7 +131,7 @@ public void asBeginTransactionParametersForBookmarkWithInvalidValue()
131131
}
132132

133133
@Test
134-
public void asBeginTransactionParametersForBookmarkWithEmptyStringValue()
134+
void asBeginTransactionParametersForBookmarkWithEmptyStringValue()
135135
{
136136
Bookmark bookmark = Bookmark.from( asList( "neo4j:bookmark:v1:tx9", "", "neo4j:bookmark:v1:tx3" ) );
137137
assertEquals( "neo4j:bookmark:v1:tx9", bookmark.maxBookmarkAsString() );
@@ -141,7 +141,7 @@ public void asBeginTransactionParametersForBookmarkWithEmptyStringValue()
141141
}
142142

143143
@Test
144-
public void asBeginTransactionParametersForBookmarkWithNullValue()
144+
void asBeginTransactionParametersForBookmarkWithNullValue()
145145
{
146146
Bookmark bookmark = Bookmark.from( asList( "neo4j:bookmark:v1:tx41", null, "neo4j:bookmark:v1:tx42" ) );
147147
assertEquals( "neo4j:bookmark:v1:tx42", bookmark.maxBookmarkAsString() );

driver/src/test/java/org/neo4j/driver/internal/DirectConnectionProviderTest.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
*/
1919
package org.neo4j.driver.internal;
2020

21-
import org.junit.Test;
21+
import org.junit.jupiter.api.Test;
2222

2323
import java.util.concurrent.CompletableFuture;
2424
import java.util.stream.Stream;
@@ -27,19 +27,19 @@
2727
import org.neo4j.driver.internal.spi.ConnectionPool;
2828

2929
import static java.util.concurrent.CompletableFuture.completedFuture;
30-
import static org.junit.Assert.assertEquals;
31-
import static org.junit.Assert.assertSame;
30+
import static org.junit.jupiter.api.Assertions.assertEquals;
31+
import static org.junit.jupiter.api.Assertions.assertSame;
3232
import static org.mockito.Mockito.mock;
3333
import static org.mockito.Mockito.verify;
3434
import static org.mockito.Mockito.when;
3535
import static org.neo4j.driver.v1.AccessMode.READ;
3636
import static org.neo4j.driver.v1.AccessMode.WRITE;
3737
import static org.neo4j.driver.v1.util.TestUtil.await;
3838

39-
public class DirectConnectionProviderTest
39+
class DirectConnectionProviderTest
4040
{
4141
@Test
42-
public void acquiresConnectionsFromThePool()
42+
void acquiresConnectionsFromThePool()
4343
{
4444
BoltServerAddress address = BoltServerAddress.LOCAL_DEFAULT;
4545
Connection connection1 = mock( Connection.class );
@@ -53,7 +53,7 @@ public void acquiresConnectionsFromThePool()
5353
}
5454

5555
@Test
56-
public void closesPool()
56+
void closesPool()
5757
{
5858
BoltServerAddress address = BoltServerAddress.LOCAL_DEFAULT;
5959
ConnectionPool pool = poolMock( address, mock( Connection.class ) );
@@ -65,7 +65,7 @@ public void closesPool()
6565
}
6666

6767
@Test
68-
public void returnsCorrectAddress()
68+
void returnsCorrectAddress()
6969
{
7070
BoltServerAddress address = new BoltServerAddress( "server-1", 25000 );
7171

0 commit comments

Comments
 (0)