Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 22 additions & 13 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,6 @@ group = 'com.meilisearch.sdk'
archivesBaseName = 'meilisearch-java'
version = '0.14.7'

java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}

jacoco {
toolVersion = "0.8.8"
reportsDirectory = layout.buildDirectory.dir("$projectDir/tmp/coverage")
Expand Down Expand Up @@ -56,10 +51,10 @@ dependencies {
api 'com.squareup.okhttp3:okhttp:4.12.0'

// Use JUnit test framework
testImplementation(platform('org.junit:junit-bom:5.11.4'))
testImplementation('org.junit.jupiter:junit-jupiter:5.11.4')
testImplementation(platform('org.junit:junit-bom:5.13.0'))
testImplementation('org.junit.jupiter:junit-jupiter:5.13.0')
// https://mvnrepository.com/artifact/org.mockito/mockito-core
testImplementation 'org.mockito:mockito-core:4.9.0'
testImplementation 'org.mockito:mockito-core:4.11.0'
testImplementation 'org.hamcrest:hamcrest:3.0'
testImplementation 'com.squareup.okio:okio:3.12.0'
testImplementation 'com.squareup.okhttp3:okhttp:4.12.0'
Expand Down Expand Up @@ -92,13 +87,12 @@ task buildJar(type: Jar) {
}

test {
finalizedBy jacocoTestReport
useJUnitPlatform {
excludeTags('integration')
excludeTags 'integration'
}

finalizedBy jacocoTestReport
testLogging {
events 'passed', 'skipped', 'failed'
events 'passed', 'skipped', 'failed'
}
}

Expand All @@ -114,7 +108,7 @@ jacocoTestReport {

task integrationTest(type: Test) {
useJUnitPlatform {
includeTags('integration')
includeTags 'integration'
}
testLogging {
events 'passed', 'skipped', 'failed'
Expand All @@ -123,10 +117,17 @@ task integrationTest(type: Test) {
}

java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8

withJavadocJar()
withSourcesJar()
}

tasks.withType(JavaCompile).configureEach {
options.compilerArgs += ['-Xlint:deprecation', '-Xlint:unchecked']
}

publishing {
publications {
mavenJava(MavenPublication) {
Expand Down Expand Up @@ -195,3 +196,11 @@ spotless {
googleJavaFormat('1.7').aosp()
}
}

testing {
suites {
test {
useJUnitJupiter()
}
}
}
4 changes: 1 addition & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
version: "3.8"

services:
package:
image: azul/zulu-openjdk:8-latest
image: azul/zulu-openjdk:11-latest
tty: true
stdin_open: true
working_dir: /home/package
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/meilisearch/sdk/MultiSearchRequest.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ public class MultiSearchRequest {
private ArrayList<IndexSearchRequest> queries;

public MultiSearchRequest() {
this.queries = new ArrayList();
this.queries = new ArrayList<IndexSearchRequest>();
}

/*
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/com/meilisearch/sdk/SettingsHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -706,6 +706,7 @@ public String[] getSeparatorTokensSettings(String uid) {
* Updates the separator tokens settings of the index
*
* @param uid Index identifier
* @param separatorTokens an array of strings that contains the new separator tokens settings
* @return TaskInfo instance
* @throws MeilisearchException if an error occurs
*/
Expand Down Expand Up @@ -746,6 +747,7 @@ public String[] getNonSeparatorTokensSettings(String uid) {
* Updates the non-separator tokens settings of the index
*
* @param uid Index identifier
* @param separatorTokens an array of strings that contains the new separator tokens settings
* @return TaskInfo instance
* @throws MeilisearchException if an error occurs
*/
Expand Down
17 changes: 7 additions & 10 deletions src/test/java/com/meilisearch/sdk/json/GsonJsonHandlerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import java.util.stream.Stream;
import lombok.Getter;
import org.junit.jupiter.api.Test;
import org.mockito.Mockito;

class GsonJsonHandlerTest {

Expand Down Expand Up @@ -68,16 +69,11 @@ void encodeAnObject() {

@Test
void encodeThrowsJsonEncodingExceptionWhenGsonThrowsException() {
assertThrows(
JsonEncodingException.class,
() ->
classToTest.encode(
new JsonElement() {
@Override
public JsonElement deepCopy() {
return null;
}
}));
JsonElement mockElement = Mockito.mock(JsonElement.class);
// Optionally mock behavior (if needed):
// Mockito.when(mockElement.deepCopy()).thenReturn(null);

assertThrows(JsonEncodingException.class, () -> classToTest.encode(mockElement));
}

@Test
Expand Down Expand Up @@ -161,6 +157,7 @@ void deserializeWithParametersEmpty() throws Exception {
void deserializeMap() throws Exception {
String mapString =
"{\"commitSha\":\"b46889b5f0f2f8b91438a08a358ba8f05fc09fc1\",\"commitDate\":\"2019-11-15T09:51:54.278247+00:00\",\"pkgVersion\":\"0.1.1\"}";
@SuppressWarnings("unchecked")
HashMap<String, String> decode =
classToTest.decode(mapString, HashMap.class, String.class, String.class);

Expand Down