Skip to content

Commit 4879f07

Browse files
committed
test: Fix test for upgrading dependencies without given version
1 parent e333a9c commit 4879f07

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

components/sbm-openrewrite/src/test/java/org/springframework/sbm/support/openrewrite/api/UpgradeDependencyVersionTest.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
import org.openrewrite.xml.tree.Xml;
2525

2626
import java.util.List;
27+
import java.util.concurrent.CountDownLatch;
28+
import java.util.concurrent.TimeUnit;
2729
import java.util.concurrent.atomic.AtomicBoolean;
2830

2931
import static org.assertj.core.api.Assertions.assertThat;
@@ -200,18 +202,16 @@ private String getLatestBootReleaseVersion() {
200202
}
201203

202204
@Test
203-
void testUpgradeDependency_nullVersion() {
205+
void testUpgradeDependency_nullVersion() throws InterruptedException {
204206
String groupId = "org.springframework.boot";
205207
String artifactId = "spring-boot-starter-test";
206208
String version = null;
207209
UpgradeDependencyVersion sut = new UpgradeDependencyVersion(groupId, artifactId, version, null, false, List.of());
208210

209-
AtomicBoolean exceptionThrown = new AtomicBoolean(false);
210-
RecipeRun results = sut.run(mavens, new InMemoryExecutionContext((e) -> {
211-
e.printStackTrace();
212-
exceptionThrown.set(true);
211+
CountDownLatch thrown = new CountDownLatch(1);
212+
sut.run(mavens, new InMemoryExecutionContext((e) -> {
213+
thrown.countDown();
213214
}));
214-
// assertThat(exceptionThrown).isTrue();
215-
215+
assertThat(thrown.await(50, TimeUnit.MILLISECONDS)).isTrue();
216216
}
217217
}

0 commit comments

Comments
 (0)