Skip to content

Commit f1718a3

Browse files
committed
Fix a few warnings
1 parent 0ac9dc1 commit f1718a3

File tree

5 files changed

+31
-25
lines changed

5 files changed

+31
-25
lines changed

build.gradle

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,13 @@ plugins {
1313
id 'signing'
1414
id 'jacoco'
1515
id "io.github.gradle-nexus.publish-plugin" version "2.0.0"
16-
id "com.diffplug.spotless" version "7.0.4"
16+
id "com.diffplug.spotless" version "6.13.0"
1717
}
1818

1919
group = 'com.meilisearch.sdk'
2020
archivesBaseName = 'meilisearch-java'
2121
version = '0.14.7'
2222

23-
java {
24-
sourceCompatibility = JavaVersion.VERSION_1_8
25-
targetCompatibility = JavaVersion.VERSION_1_8
26-
}
27-
2823
jacoco {
2924
toolVersion = "0.8.8"
3025
reportsDirectory = layout.buildDirectory.dir("$projectDir/tmp/coverage")
@@ -92,13 +87,12 @@ task buildJar(type: Jar) {
9287
}
9388

9489
test {
95-
finalizedBy jacocoTestReport
9690
useJUnitPlatform {
97-
excludeTags('integration')
91+
excludeTags 'integration'
9892
}
99-
93+
finalizedBy jacocoTestReport
10094
testLogging {
101-
events 'passed', 'skipped', 'failed'
95+
events 'passed', 'skipped', 'failed'
10296
}
10397
}
10498

@@ -114,7 +108,7 @@ jacocoTestReport {
114108

115109
task integrationTest(type: Test) {
116110
useJUnitPlatform {
117-
includeTags('integration')
111+
includeTags 'integration'
118112
}
119113
testLogging {
120114
events 'passed', 'skipped', 'failed'
@@ -123,10 +117,17 @@ task integrationTest(type: Test) {
123117
}
124118

125119
java {
120+
sourceCompatibility = JavaVersion.VERSION_1_8
121+
targetCompatibility = JavaVersion.VERSION_1_8
122+
126123
withJavadocJar()
127124
withSourcesJar()
128125
}
129126

127+
tasks.withType(JavaCompile).configureEach {
128+
options.compilerArgs += ['-Xlint:deprecation', '-Xlint:unchecked']
129+
}
130+
130131
publishing {
131132
publications {
132133
mavenJava(MavenPublication) {
@@ -195,3 +196,11 @@ spotless {
195196
googleJavaFormat('1.7').aosp()
196197
}
197198
}
199+
200+
testing {
201+
suites {
202+
test {
203+
useJUnitJupiter()
204+
}
205+
}
206+
}

docker-compose.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
version: "3.8"
2-
31
services:
42
package:
5-
image: azul/zulu-openjdk:8-latest
3+
image: azul/zulu-openjdk:11-latest
64
tty: true
75
stdin_open: true
86
working_dir: /home/package

src/main/java/com/meilisearch/sdk/MultiSearchRequest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ public class MultiSearchRequest {
66
private ArrayList<IndexSearchRequest> queries;
77

88
public MultiSearchRequest() {
9-
this.queries = new ArrayList();
9+
this.queries = new ArrayList<IndexSearchRequest>();
1010
}
1111

1212
/*

src/main/java/com/meilisearch/sdk/SettingsHandler.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -706,6 +706,7 @@ public String[] getSeparatorTokensSettings(String uid) {
706706
* Updates the separator tokens settings of the index
707707
*
708708
* @param uid Index identifier
709+
* @param separatorTokens an array of strings that contains the new separator tokens settings
709710
* @return TaskInfo instance
710711
* @throws MeilisearchException if an error occurs
711712
*/
@@ -746,6 +747,7 @@ public String[] getNonSeparatorTokensSettings(String uid) {
746747
* Updates the non-separator tokens settings of the index
747748
*
748749
* @param uid Index identifier
750+
* @param separatorTokens an array of strings that contains the new separator tokens settings
749751
* @return TaskInfo instance
750752
* @throws MeilisearchException if an error occurs
751753
*/

src/test/java/com/meilisearch/sdk/json/GsonJsonHandlerTest.java

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import java.util.stream.Stream;
2929
import lombok.Getter;
3030
import org.junit.jupiter.api.Test;
31+
import org.mockito.Mockito;
3132

3233
class GsonJsonHandlerTest {
3334

@@ -68,16 +69,11 @@ void encodeAnObject() {
6869

6970
@Test
7071
void encodeThrowsJsonEncodingExceptionWhenGsonThrowsException() {
71-
assertThrows(
72-
JsonEncodingException.class,
73-
() ->
74-
classToTest.encode(
75-
new JsonElement() {
76-
@Override
77-
public JsonElement deepCopy() {
78-
return null;
79-
}
80-
}));
72+
JsonElement mockElement = Mockito.mock(JsonElement.class);
73+
// Optionally mock behavior (if needed):
74+
// Mockito.when(mockElement.deepCopy()).thenReturn(null);
75+
76+
assertThrows(JsonEncodingException.class, () -> classToTest.encode(mockElement));
8177
}
8278

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

0 commit comments

Comments
 (0)