Skip to content

Commit c8a52be

Browse files
authored
Merge branch 'main' into clarify-scope-of-maven-RemoveDependency
2 parents 8dd1822 + bbb7346 commit c8a52be

52 files changed

Lines changed: 251 additions & 233 deletions

File tree

Some content is hidden

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

rewrite-core/src/test/java/org/openrewrite/RecipeEstimatedEffortTest.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939

4040
import static java.util.Collections.emptyList;
4141
import static java.util.Objects.requireNonNull;
42-
import static java.util.stream.Collectors.toList;
4342
import static org.assertj.core.api.Assertions.assertThat;
4443
import static org.openrewrite.Tree.randomId;
4544
import static org.openrewrite.marker.GitProvenance.AutoCRLF.False;
@@ -132,12 +131,12 @@ void customEstimatedEffortForRecipeThatGeneratesSourceFiles() {
132131
));
133132
}
134133

135-
@ParameterizedTest
136134
@CsvSource({
137135
"'foo is here', 'bar is here', 10", // Only recipe1 applies
138136
"'baz is here', 'qux is here', 5", // Only recipe2 applies
139137
"'foo and baz are here', 'bar and qux are here', 15" // Both recipes apply
140138
})
139+
@ParameterizedTest
141140
void estimatedTimeSavingsForMultipleRecipes(String beforeContent, String afterContent, int expectedMinutes) {
142141
// Create composite recipe with 2 recipes that have different estimated efforts
143142
Recipe recipe1 = new CustomEstimatedEffortFindReplaceRecipe("foo", "bar", Duration.ofMinutes(10));
@@ -288,7 +287,7 @@ public Collection<SourceFile> generate(AtomicBoolean shouldCreate, ExecutionCont
288287
if (shouldCreate.get()) {
289288
return PlainTextParser.builder().build().parse(fileContents)
290289
.map(brandNewFile -> (SourceFile) brandNewFile.withSourcePath(Path.of(relativeFileName)))
291-
.collect(toList());
290+
.toList();
292291
}
293292
return emptyList();
294293
}

rewrite-core/src/test/java/org/openrewrite/SingletonTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ class SingletonTest implements RewriteTest {
3939
* A simplified recipe that appends content to a text file.
4040
* Uses Singleton to ensure only one instance with the same content parameter makes changes.
4141
*/
42-
@Value
4342
@EqualsAndHashCode(callSuper = false)
43+
@Value
4444
static class SingletonAppend extends Recipe {
4545
String content;
4646

rewrite-core/src/test/java/org/openrewrite/TreeTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,11 @@ public String afterSyntax(Marker marker, Cursor cursor, UnaryOperator<String> co
5757
);
5858
}
5959

60-
@ParameterizedTest
6160
@CsvSource({
6261
"true, '\uFEFFHello World'",
6362
"false, 'Hello World'"
6463
})
64+
@ParameterizedTest
6565
void printBomHandling(boolean charsetBomMarked, String expected) {
6666
PlainText sourceFile = new PlainText(
6767
Tree.randomId(),

rewrite-docker/src/test/java/org/openrewrite/docker/search/FindBaseImagesTest.java

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,12 @@
1717

1818
import org.junit.jupiter.api.Test;
1919
import org.openrewrite.DocumentExample;
20-
import org.openrewrite.docker.Assertions;
2120
import org.openrewrite.docker.table.BaseImages;
2221
import org.openrewrite.test.RecipeSpec;
2322
import org.openrewrite.test.RewriteTest;
2423

24+
import static org.openrewrite.docker.Assertions.docker;
25+
2526
class FindBaseImagesTest implements RewriteTest {
2627

2728
@Override
@@ -40,7 +41,7 @@ void findAllBaseImages() {
4041
Dockerfile,,ubuntu,22.04,,
4142
"""
4243
),
43-
Assertions.docker(
44+
docker(
4445
"""
4546
FROM ubuntu:22.04
4647
RUN apt-get update
@@ -64,7 +65,7 @@ void findBaseImageWithPattern() {
6465
Dockerfile,,ubuntu,22.04,,
6566
"""
6667
),
67-
Assertions.docker(
68+
docker(
6869
"""
6970
FROM ubuntu:22.04
7071
RUN apt-get update
@@ -81,7 +82,7 @@ void findBaseImageWithPattern() {
8182
void noMatchWithPattern() {
8283
rewriteRun(
8384
spec -> spec.recipe(new FindBaseImages("alpine*", null, null, null)),
84-
Assertions.docker(
85+
docker(
8586
"""
8687
FROM ubuntu:22.04
8788
RUN apt-get update
@@ -100,7 +101,7 @@ void findBaseImageWithDigest() {
100101
Dockerfile,,ubuntu,,sha256:abc123,
101102
"""
102103
),
103-
Assertions.docker(
104+
docker(
104105
"""
105106
FROM ubuntu@sha256:abc123
106107
RUN apt-get update
@@ -123,7 +124,7 @@ void findBaseImageWithPlatform() {
123124
Dockerfile,,ubuntu,22.04,,linux/amd64
124125
"""
125126
),
126-
Assertions.docker(
127+
docker(
127128
"""
128129
FROM --platform=linux/amd64 ubuntu:22.04
129130
RUN apt-get update
@@ -146,7 +147,7 @@ void findBaseImageWithStageName() {
146147
Dockerfile,builder,golang,1.21,,
147148
"""
148149
),
149-
Assertions.docker(
150+
docker(
150151
"""
151152
FROM golang:1.21 AS builder
152153
RUN go build -o app .
@@ -170,7 +171,7 @@ void findMultipleBaseImages() {
170171
Dockerfile,,alpine,latest,,
171172
"""
172173
),
173-
Assertions.docker(
174+
docker(
174175
"""
175176
FROM golang:1.21 AS builder
176177
RUN go build -o app .
@@ -200,7 +201,7 @@ void filterByPatternInMultiStage() {
200201
Dockerfile,,alpine,latest,,
201202
"""
202203
),
203-
Assertions.docker(
204+
docker(
204205
"""
205206
FROM golang:1.21 AS builder
206207
RUN go build -o app .
@@ -229,7 +230,7 @@ void findBaseImageWithAllDetails() {
229230
Dockerfile,base,ubuntu,22.04,,linux/arm64
230231
"""
231232
),
232-
Assertions.docker(
233+
docker(
233234
"""
234235
FROM --platform=linux/arm64 ubuntu:22.04 AS base
235236
RUN apt-get update
@@ -252,7 +253,7 @@ void findBaseImageWithoutTag() {
252253
Dockerfile,,ubuntu,,,
253254
"""
254255
),
255-
Assertions.docker(
256+
docker(
256257
"""
257258
FROM ubuntu
258259
RUN apt-get update
@@ -275,7 +276,7 @@ void findBaseImageWithGlobalArg() {
275276
Dockerfile,,"${BASE_IMAGE}","${BASE_TAG}",,
276277
"""
277278
),
278-
Assertions.docker(
279+
docker(
279280
"""
280281
ARG BASE_IMAGE=ubuntu
281282
ARG BASE_TAG=22.04
@@ -303,7 +304,7 @@ void filterByTagPattern() {
303304
Dockerfile,,ubuntu,22.04,,
304305
"""
305306
),
306-
Assertions.docker(
307+
docker(
307308
"""
308309
FROM ubuntu:22.04
309310
FROM ubuntu:20.04
@@ -329,7 +330,7 @@ void filterByDigestPattern() {
329330
Dockerfile,,ubuntu,,sha256:abc123,
330331
"""
331332
),
332-
Assertions.docker(
333+
docker(
333334
"""
334335
FROM ubuntu@sha256:abc123
335336
FROM alpine@sha256:def456
@@ -353,7 +354,7 @@ void filterByPlatformPattern() {
353354
Dockerfile,,ubuntu,22.04,,linux/arm64
354355
"""
355356
),
356-
Assertions.docker(
357+
docker(
357358
"""
358359
FROM --platform=linux/arm64 ubuntu:22.04
359360
FROM --platform=linux/amd64 alpine:latest
@@ -377,7 +378,7 @@ void filterByMultiplePatterns() {
377378
Dockerfile,,ubuntu,22.04,,linux/amd64
378379
"""
379380
),
380-
Assertions.docker(
381+
docker(
381382
"""
382383
FROM --platform=linux/amd64 ubuntu:22.04
383384
FROM --platform=linux/arm64 ubuntu:22.04
@@ -398,7 +399,7 @@ void filterByMultiplePatterns() {
398399
void noMatchWithTagPattern() {
399400
rewriteRun(
400401
spec -> spec.recipe(new FindBaseImages(null, "18.*", null, null)),
401-
Assertions.docker(
402+
docker(
402403
"""
403404
FROM ubuntu:22.04
404405
FROM ubuntu:20.04

0 commit comments

Comments
 (0)