Skip to content

Commit e2adfb1

Browse files
committed
style: Apply code formatting
1 parent 53b3869 commit e2adfb1

File tree

2 files changed

+9
-12
lines changed

2 files changed

+9
-12
lines changed

modules/mongodb/src/main/java/org/testcontainers/containers/MongoDBContainer.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -236,10 +236,7 @@ void withSharding() {
236236
* @return this container instance
237237
*/
238238
public MongoDBContainer withInitScript(String scriptPath) {
239-
withCopyFileToContainer(
240-
MountableFile.forClasspathResource(scriptPath),
241-
"/docker-entrypoint-initdb.d/init.js"
242-
);
239+
withCopyFileToContainer(MountableFile.forClasspathResource(scriptPath), "/docker-entrypoint-initdb.d/init.js");
243240

244241
this.waitStrategy = Wait.forLogMessage("(?i).*waiting for connections.*", 2);
245242

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package org.testcontainers.containers;
22

33
import org.junit.jupiter.api.Test;
4-
import org.testcontainers.utility.MountableFile;
54

65
import java.time.Duration;
76

@@ -12,16 +11,17 @@ class MongoDBInitScriptTest {
1211
@Test
1312
void testWithInitScript() {
1413
// Start the container using try-with-resources to ensure it closes automatically
15-
try (MongoDBContainer mongoDB = new MongoDBContainer("mongo:4.0.10")
16-
// Configure the init script. This triggers a restart inside the container,
17-
// so the container must wait for the second "waiting for connections" log message.
18-
.withInitScript("init.js")
19-
.withStartupTimeout(Duration.ofSeconds(30))) {
20-
14+
try (
15+
MongoDBContainer mongoDB = new MongoDBContainer("mongo:4.0.10")
16+
// Configure the init script. This triggers a restart inside the container,
17+
// so the container must wait for the second "waiting for connections" log message.
18+
.withInitScript("init.js")
19+
.withStartupTimeout(Duration.ofSeconds(30))
20+
) {
2121
mongoDB.start();
2222

2323
// Assert that the container started successfully
2424
assertThat(mongoDB.isRunning()).isTrue();
2525
}
2626
}
27-
}
27+
}

0 commit comments

Comments
 (0)