Skip to content

Commit d0c5339

Browse files
committed
Update spring-javaformat to version 0.0.43
- Ran ./mvnw spring-javaformat:apply that made some new formatting changes
1 parent 2e0a51f commit d0c5339

File tree

10 files changed

+39
-41
lines changed

10 files changed

+39
-41
lines changed

models/spring-ai-minimax/src/test/java/org/springframework/ai/minimax/api/MiniMaxRetryTests.java

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -120,11 +120,11 @@ public void miniMaxChatTransientError() {
120120
}
121121

122122
@Test
123-
public void miniMaxChatNonTransientError() {
124-
when(miniMaxApi.chatCompletionEntity(isA(ChatCompletionRequest.class)))
125-
.thenThrow(new RuntimeException("Non Transient Error"));
126-
assertThrows(RuntimeException.class, () -> chatModel.call(new Prompt("text")));
127-
}
123+
public void miniMaxChatNonTransientError() {
124+
when(miniMaxApi.chatCompletionEntity(isA(ChatCompletionRequest.class)))
125+
.thenThrow(new RuntimeException("Non Transient Error"));
126+
assertThrows(RuntimeException.class, () -> chatModel.call(new Prompt("text")));
127+
}
128128

129129
@Test
130130
public void miniMaxChatStreamTransientError() {
@@ -148,11 +148,11 @@ public void miniMaxChatStreamTransientError() {
148148
}
149149

150150
@Test
151-
public void miniMaxChatStreamNonTransientError() {
152-
when(miniMaxApi.chatCompletionStream(isA(ChatCompletionRequest.class)))
153-
.thenThrow(new RuntimeException("Non Transient Error"));
154-
assertThrows(RuntimeException.class, () -> chatModel.stream(new Prompt("text")).collectList().block());
155-
}
151+
public void miniMaxChatStreamNonTransientError() {
152+
when(miniMaxApi.chatCompletionStream(isA(ChatCompletionRequest.class)))
153+
.thenThrow(new RuntimeException("Non Transient Error"));
154+
assertThrows(RuntimeException.class, () -> chatModel.stream(new Prompt("text")).collectList().block());
155+
}
156156

157157
@Test
158158
public void miniMaxEmbeddingTransientError() {
@@ -174,11 +174,10 @@ public void miniMaxEmbeddingTransientError() {
174174
}
175175

176176
@Test
177-
public void miniMaxEmbeddingNonTransientError() {
178-
when(miniMaxApi.embeddings(isA(EmbeddingRequest.class)))
179-
.thenThrow(new RuntimeException("Non Transient Error"));
180-
assertThrows(RuntimeException.class, () -> embeddingModel
181-
.call(new org.springframework.ai.embedding.EmbeddingRequest(List.of("text1", "text2"), null)));
182-
}
177+
public void miniMaxEmbeddingNonTransientError() {
178+
when(miniMaxApi.embeddings(isA(EmbeddingRequest.class))).thenThrow(new RuntimeException("Non Transient Error"));
179+
assertThrows(RuntimeException.class, () -> embeddingModel
180+
.call(new org.springframework.ai.embedding.EmbeddingRequest(List.of("text1", "text2"), null)));
181+
}
183182

184183
}

models/spring-ai-mistral-ai/src/test/java/org/springframework/ai/mistralai/MistralAiRetryTests.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ public void mistralAiChatTransientError() {
131131
@Test
132132
public void mistralAiChatNonTransientError() {
133133
when(mistralAiApi.chatCompletionEntity(isA(ChatCompletionRequest.class)))
134-
.thenThrow(new RuntimeException("Non Transient Error"));
134+
.thenThrow(new RuntimeException("Non Transient Error"));
135135
assertThrows(RuntimeException.class, () -> chatModel.call(new Prompt("text")));
136136
}
137137

@@ -161,7 +161,7 @@ public void mistralAiChatStreamTransientError() {
161161
@Disabled("Currently stream() does not implement retry")
162162
public void mistralAiChatStreamNonTransientError() {
163163
when(mistralAiApi.chatCompletionStream(isA(ChatCompletionRequest.class)))
164-
.thenThrow(new RuntimeException("Non Transient Error"));
164+
.thenThrow(new RuntimeException("Non Transient Error"));
165165
assertThrows(RuntimeException.class, () -> chatModel.stream(new Prompt("text")));
166166
}
167167

@@ -188,9 +188,9 @@ public void mistralAiEmbeddingTransientError() {
188188
@Test
189189
public void mistralAiEmbeddingNonTransientError() {
190190
when(mistralAiApi.embeddings(isA(EmbeddingRequest.class)))
191-
.thenThrow(new RuntimeException("Non Transient Error"));
191+
.thenThrow(new RuntimeException("Non Transient Error"));
192192
assertThrows(RuntimeException.class, () -> embeddingModel
193-
.call(new org.springframework.ai.embedding.EmbeddingRequest(List.of("text1", "text2"), null)));
193+
.call(new org.springframework.ai.embedding.EmbeddingRequest(List.of("text1", "text2"), null)));
194194
}
195195

196196
}

models/spring-ai-moonshot/src/test/java/org/springframework/ai/moonshot/MoonshotRetryTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ public void moonshotChatTransientError() {
116116
@Test
117117
public void moonshotChatNonTransientError() {
118118
when(moonshotApi.chatCompletionEntity(isA(ChatCompletionRequest.class)))
119-
.thenThrow(new RuntimeException("Non Transient Error"));
119+
.thenThrow(new RuntimeException("Non Transient Error"));
120120
assertThrows(RuntimeException.class, () -> chatModel.call(new Prompt("text")));
121121
}
122122

@@ -144,7 +144,7 @@ public void moonshotChatStreamTransientError() {
144144
@Test
145145
public void moonshotChatStreamNonTransientError() {
146146
when(moonshotApi.chatCompletionStream(isA(ChatCompletionRequest.class)))
147-
.thenThrow(new RuntimeException("Non Transient Error"));
147+
.thenThrow(new RuntimeException("Non Transient Error"));
148148
assertThrows(RuntimeException.class, () -> chatModel.stream(new Prompt("text")).collectList().block());
149149
}
150150

models/spring-ai-vertex-ai-embedding/src/test/java/org/springframework/ai/vertexai/embedding/text/VertexAiTextEmbeddingRetryTests.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -148,12 +148,11 @@ public void vertexAiEmbeddingTransientError() {
148148
@Test
149149
public void vertexAiEmbeddingNonTransientError() {
150150
// Setup the mock PredictionServiceClient to throw a non-transient error
151-
when(mockPredictionServiceClient.predict(any()))
152-
.thenThrow(new RuntimeException("Non Transient Error"));
151+
when(mockPredictionServiceClient.predict(any())).thenThrow(new RuntimeException("Non Transient Error"));
153152

154153
// Assert that a RuntimeException is thrown and not retried
155-
assertThrows(RuntimeException.class, () -> embeddingModel
156-
.call(new EmbeddingRequest(List.of("text1", "text2"), null)));
154+
assertThrows(RuntimeException.class,
155+
() -> embeddingModel.call(new EmbeddingRequest(List.of("text1", "text2"), null)));
157156

158157
// Verify that predict was called only once (no retries for non-transient errors)
159158
verify(mockPredictionServiceClient, times(1)).predict(any());

models/spring-ai-vertex-ai-gemini/src/test/java/org/springframework/ai/vertexai/gemini/VertexAiGeminiRetryTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ public void vertexAiGeminiChatTransientError() throws IOException {
130130
public void vertexAiGeminiChatNonTransientError() throws Exception {
131131
// Set up the mock GenerativeModel to throw a non-transient RuntimeException
132132
when(mockGenerativeModel.generateContent(any(List.class)))
133-
.thenThrow(new RuntimeException("Non Transient Error"));
133+
.thenThrow(new RuntimeException("Non Transient Error"));
134134

135135
// Assert that a RuntimeException is thrown when calling the chat model
136136
assertThrows(RuntimeException.class, () -> chatModel.call(new Prompt("test prompt")));

models/spring-ai-zhipuai/src/test/java/org/springframework/ai/zhipuai/api/ZhiPuAiRetryTests.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ public void zhiPuAiChatTransientError() {
135135
@Test
136136
public void zhiPuAiChatNonTransientError() {
137137
when(zhiPuAiApi.chatCompletionEntity(isA(ChatCompletionRequest.class)))
138-
.thenThrow(new RuntimeException("Non Transient Error"));
138+
.thenThrow(new RuntimeException("Non Transient Error"));
139139
assertThrows(RuntimeException.class, () -> chatModel.call(new Prompt("text")));
140140
}
141141

@@ -163,7 +163,7 @@ public void zhiPuAiChatStreamTransientError() {
163163
@Test
164164
public void zhiPuAiChatStreamNonTransientError() {
165165
when(zhiPuAiApi.chatCompletionStream(isA(ChatCompletionRequest.class)))
166-
.thenThrow(new RuntimeException("Non Transient Error"));
166+
.thenThrow(new RuntimeException("Non Transient Error"));
167167
assertThrows(RuntimeException.class, () -> chatModel.stream(new Prompt("text")).collectList().block());
168168
}
169169

@@ -189,10 +189,9 @@ public void zhiPuAiEmbeddingTransientError() {
189189

190190
@Test
191191
public void zhiPuAiEmbeddingNonTransientError() {
192-
when(zhiPuAiApi.embeddings(isA(EmbeddingRequest.class)))
193-
.thenThrow(new RuntimeException("Non Transient Error"));
192+
when(zhiPuAiApi.embeddings(isA(EmbeddingRequest.class))).thenThrow(new RuntimeException("Non Transient Error"));
194193
assertThrows(RuntimeException.class, () -> embeddingModel
195-
.call(new org.springframework.ai.embedding.EmbeddingRequest(List.of("text1", "text2"), null)));
194+
.call(new org.springframework.ai.embedding.EmbeddingRequest(List.of("text1", "text2"), null)));
196195
}
197196

198197
@Test
@@ -216,7 +215,7 @@ public void zhiPuAiImageTransientError() {
216215
@Test
217216
public void zhiPuAiImageNonTransientError() {
218217
when(zhiPuAiImageApi.createImage(isA(ZhiPuAiImageRequest.class)))
219-
.thenThrow(new RuntimeException("Transient Error 1"));
218+
.thenThrow(new RuntimeException("Transient Error 1"));
220219
assertThrows(RuntimeException.class,
221220
() -> imageModel.call(new ImagePrompt(List.of(new ImageMessage("Image Message")))));
222221
}

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@
221221
<maven-site-plugin.version>4.0.0-M13</maven-site-plugin.version>
222222
<maven-project-info-reports-plugin.version>3.4.5</maven-project-info-reports-plugin.version>
223223
<maven-jar-plugin.version>3.3.0</maven-jar-plugin.version>
224-
<spring-javaformat-maven-plugin.version>0.0.39</spring-javaformat-maven-plugin.version>
224+
<spring-javaformat-maven-plugin.version>0.0.43</spring-javaformat-maven-plugin.version>
225225

226226
</properties>
227227

spring-ai-core/src/test/java/org/springframework/ai/chat/client/ChatClientTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,8 @@ public void simpleUserPromptObject() throws MalformedURLException {
468468
when(chatModel.call(promptCaptor.capture()))
469469
.thenReturn(new ChatResponse(List.of(new Generation(new AssistantMessage("response")))));
470470

471-
var media = new Media(MimeTypeUtils.IMAGE_JPEG, new DefaultResourceLoader().getResource("classpath:/bikes.json"));
471+
var media = new Media(MimeTypeUtils.IMAGE_JPEG,
472+
new DefaultResourceLoader().getResource("classpath:/bikes.json"));
472473

473474
UserMessage message = new UserMessage("User prompt", List.of(media));
474475
Prompt prompt = new Prompt(message);

spring-ai-core/src/test/java/org/springframework/ai/embedding/AbstractEmbeddingModelTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ public void testKnownEmbeddingModelDimensions(String model, String dimension) {
8787

8888
@Test
8989
public void testUnknownModelDimension() {
90-
when(embeddingModel.embed(eq("Hello world!"))).thenReturn(new float[]{0.1f, 0.1f, 0.1f});
90+
when(embeddingModel.embed(eq("Hello world!"))).thenReturn(new float[] { 0.1f, 0.1f, 0.1f });
9191
assertThat(AbstractEmbeddingModel.dimensions(embeddingModel, "unknown_model", "Hello world!")).isEqualTo(3);
9292
}
9393

vector-stores/spring-ai-milvus-store/src/test/java/org/springframework/ai/vectorstore/MilvusEmbeddingDimensionsTests.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ public void embeddingModelDimensions() {
7070

7171
MilvusVectorStoreConfig config = MilvusVectorStoreConfig.builder().build();
7272

73-
var dim = new MilvusVectorStore(milvusClient, embeddingModel, config ,true, new TokenCountBatchingStrategy())
74-
.embeddingDimensions();
73+
var dim = new MilvusVectorStore(milvusClient, embeddingModel, config, true, new TokenCountBatchingStrategy())
74+
.embeddingDimensions();
7575

7676
assertThat(dim).isEqualTo(969);
7777

@@ -83,9 +83,9 @@ public void fallBackToDefaultDimensions() {
8383

8484
when(embeddingModel.dimensions()).thenThrow(new RuntimeException());
8585

86-
var dim = new MilvusVectorStore(milvusClient, embeddingModel,
87-
MilvusVectorStoreConfig.builder().build() ,true, new TokenCountBatchingStrategy())
88-
.embeddingDimensions();
86+
var dim = new MilvusVectorStore(milvusClient, embeddingModel, MilvusVectorStoreConfig.builder().build(), true,
87+
new TokenCountBatchingStrategy())
88+
.embeddingDimensions();
8989

9090
assertThat(dim).isEqualTo(MilvusVectorStore.OPENAI_EMBEDDING_DIMENSION_SIZE);
9191
verify(embeddingModel, only()).dimensions();

0 commit comments

Comments
 (0)