Skip to content

Commit 1b64ccf

Browse files
authored
Merge pull request #34 from snigdhasjg/master
Update junit version to 5
2 parents 7a8829c + f87a62f commit 1b64ccf

14 files changed

+292
-188
lines changed

build.gradle

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ plugins {
22
id 'java'
33
id 'signing'
44
id 'maven-publish'
5-
id('io.github.gradle-nexus.publish-plugin') version '1.1.0'
6-
id("com.github.johnrengelman.shadow") version "7.1.2"
5+
id 'io.github.gradle-nexus.publish-plugin' version "${nexusPluginVersion}"
6+
id 'com.github.johnrengelman.shadow' version "${shadowJarPluginVersion}"
77
}
88

99
repositories {
@@ -57,17 +57,23 @@ tasks.register('integrationTest', Test) {
5757
check.dependsOn integrationTest
5858

5959
dependencies {
60-
implementation "javax.xml.bind:jaxb-api:2.3.1"
61-
implementation "com.fasterxml.jackson.core:jackson-databind:2.14.1"
62-
implementation "io.swagger.core.v3:swagger-annotations:2.0.0"
63-
implementation "org.slf4j:slf4j-api:2.0.5"
64-
implementation "com.squareup.okhttp3:okhttp:4.9.1"
65-
66-
testImplementation "org.slf4j:slf4j-simple:2.0.5"
67-
testImplementation "junit:junit:4.12"
68-
testImplementation "org.hamcrest:hamcrest-all:1.3"
69-
integrationTestImplementation "junit:junit:4.12"
70-
integrationTestImplementation "org.hamcrest:hamcrest-all:1.3"
60+
implementation "javax.xml.bind:jaxb-api:${javaxXmlBindVersion}"
61+
implementation "com.fasterxml.jackson.core:jackson-databind:${jacksonCoreVersion}"
62+
implementation "io.swagger.core.v3:swagger-annotations:${swaggerCoreV3Version}"
63+
implementation "org.slf4j:slf4j-api:${slf4jVersion}"
64+
implementation "com.squareup.okhttp3:okhttp:${okhttp3Version}"
65+
66+
testImplementation "org.junit.jupiter:junit-jupiter-api:${junitJupiterVersion}"
67+
testImplementation "org.hamcrest:hamcrest-all:${hamcrestVersion}"
68+
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:${junitJupiterVersion}"
69+
70+
integrationTestImplementation "org.junit.jupiter:junit-jupiter-api:${junitJupiterVersion}"
71+
integrationTestImplementation "org.hamcrest:hamcrest-all:${hamcrestVersion}"
72+
integrationTestRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:${junitJupiterVersion}"
73+
}
74+
75+
tasks.withType(Test).configureEach {
76+
useJUnitPlatform()
7177
}
7278

7379
nexusPublishing {

docker-compose.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
version: "3"
2+
3+
services:
4+
typesense:
5+
image: typesense/typesense:0.24.1
6+
container_name: "typesense"
7+
ports:
8+
- "8108:8108"
9+
volumes:
10+
- data-dir:/data
11+
environment:
12+
TYPESENSE_DATA_DIR: /data
13+
TYPESENSE_API_KEY: xyz
14+
restart: "no"
15+
16+
volumes:
17+
data-dir:

gradle.properties

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Plugin versions
2+
nexusPluginVersion=1.1.0
3+
shadowJarPluginVersion=7.1.2
4+
5+
# Dependency versions
6+
hamcrestVersion=1.3
7+
jacksonCoreVersion=2.14.1
8+
javaxXmlBindVersion=2.3.1
9+
junitJupiterVersion=5.9.3
10+
okhttp3Version=4.9.1
11+
slf4jVersion=2.0.5
12+
swaggerCoreV3Version=2.0.0

src/test/java/org/typesense/api/AliasesTest.java

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,54 @@
11
package org.typesense.api;
22

3-
import junit.framework.TestCase;
4-
import org.typesense.api.exceptions.TypesenseError;
3+
import org.junit.jupiter.api.AfterEach;
4+
import org.junit.jupiter.api.BeforeEach;
5+
import org.junit.jupiter.api.Test;
56
import org.typesense.model.CollectionAlias;
67
import org.typesense.model.CollectionAliasSchema;
78
import org.typesense.model.CollectionAliasesResponse;
8-
import org.typesense.resources.Node;
99

10-
import java.time.Duration;
11-
import java.util.ArrayList;
12-
13-
public class AliasesTest extends TestCase {
10+
class AliasesTest {
1411

1512
private Client client;
1613
private Helper helper;
1714

18-
public void setUp() throws Exception {
19-
super.setUp();
15+
@BeforeEach
16+
void setUp() throws Exception {
2017
helper = new Helper();
2118
helper.teardown();
2219
client = helper.getClient();
2320
helper.createTestAlias();
2421
}
2522

26-
public void tearDown() throws Exception {
27-
super.tearDown();
23+
@AfterEach
24+
void tearDown() throws Exception {
2825
helper.teardown();
2926
}
3027

31-
public void testUpsert() throws Exception {
28+
@Test
29+
void testUpsert() throws Exception {
3230
CollectionAliasSchema collectionAliasSchema = new CollectionAliasSchema();
3331
collectionAliasSchema.collectionName("books_june11");
3432

3533
System.out.println(client.aliases().upsert("books1", collectionAliasSchema));
3634
}
3735

38-
public void testRetrieveAll() throws Exception {
36+
@Test
37+
void testRetrieveAll() throws Exception {
3938
CollectionAliasesResponse collectionAliasesResponse = client.aliases().retrieve();
4039

4140
System.out.println(collectionAliasesResponse);
4241
}
4342

44-
public void testRetrieveSingleAlias() throws Exception {
43+
@Test
44+
void testRetrieveSingleAlias() throws Exception {
4545
CollectionAlias collectionAlias = client.aliases("books").retrieve();
4646

4747
System.out.println(collectionAlias);
4848
}
4949

50-
public void testDelete() throws Exception {
50+
@Test
51+
void testDelete() throws Exception {
5152
CollectionAlias collectionAlias = client.aliases("books").delete();
5253

5354
System.out.println(collectionAlias);

src/test/java/org/typesense/api/CollectionsTest.java

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,55 @@
11
package org.typesense.api;
22

3-
import junit.framework.TestCase;
3+
import org.junit.jupiter.api.AfterEach;
4+
import org.junit.jupiter.api.BeforeEach;
5+
import org.junit.jupiter.api.Test;
46
import org.typesense.model.CollectionResponse;
57
import org.typesense.model.CollectionSchema;
68
import org.typesense.model.Field;
79

810
import java.util.ArrayList;
911

1012

11-
public class CollectionsTest extends TestCase {
13+
class CollectionsTest {
1214

13-
public Client client;
15+
Client client;
1416
private Helper helper;
1517

16-
public void setUp() throws Exception {
17-
super.setUp();
18+
@BeforeEach
19+
void setUp() throws Exception {
1820
helper = new Helper();
1921
helper.teardown();
2022
this.client = helper.getClient();
2123
}
2224

23-
public void tearDown() throws Exception {
24-
super.tearDown();
25+
@AfterEach
26+
void tearDown() throws Exception {
2527
helper.teardown();
2628
}
2729

2830

29-
public void testRetrieveAllCollections() throws Exception {
31+
@Test
32+
void testRetrieveAllCollections() throws Exception {
3033
helper.createTestCollection();
3134
CollectionResponse[] collectionResponses = client.collections().retrieve();
3235
for(CollectionResponse c:collectionResponses)
3336
System.out.println(c);
3437
}
3538

36-
public void testRetrieveSingleCollection() throws Exception {
39+
@Test
40+
void testRetrieveSingleCollection() throws Exception {
3741
helper.createTestCollection();
3842
System.out.println(client.collections("books").retrieve());
3943
}
4044

41-
public void testDeleteCollection() throws Exception {
45+
@Test
46+
void testDeleteCollection() throws Exception {
4247
helper.createTestCollection();
4348
System.out.println(client.collections("books").delete());
4449
}
4550

46-
public void testCreateCollection() throws Exception {
51+
@Test
52+
void testCreateCollection() throws Exception {
4753

4854
ArrayList<Field> fields = new ArrayList<>();
4955
fields.add(new Field().name("countryName").type(FieldTypes.STRING));

0 commit comments

Comments
 (0)