Skip to content

Commit 12a7f1d

Browse files
committed
chore: code style
1 parent b42dc28 commit 12a7f1d

File tree

2 files changed

+14
-12
lines changed

2 files changed

+14
-12
lines changed

callback/src/main/java/com/iluwatar/callback/Task.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,15 @@
2929
/** Template-method class for callback hook execution. */
3030
public abstract class Task {
3131

32-
/** Execute the task and asynchronously call the callback method upon completion.*/
32+
/** Execute the task and asynchronously call the callback method upon completion. */
3333
final void executeWith(Callback callback) {
34-
CompletableFuture.runAsync(() -> {
35-
execute();
36-
if (callback != null) {
37-
callback.call();
38-
}
39-
});
34+
CompletableFuture.runAsync(
35+
() -> {
36+
execute();
37+
if (callback != null) {
38+
callback.call();
39+
}
40+
});
4041
}
4142

4243
public abstract void execute();

callback/src/test/java/com/iluwatar/callback/CallbackTest.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@
2626

2727
import static org.junit.jupiter.api.Assertions.assertEquals;
2828

29-
import org.junit.jupiter.api.Test;
3029
import java.util.concurrent.CountDownLatch;
3130
import java.util.concurrent.TimeUnit;
31+
import org.junit.jupiter.api.Test;
3232

3333
/**
3434
* Add a field as a counter. Every time the callback method is called increment this field. Unit
@@ -45,10 +45,11 @@ void test() throws InterruptedException {
4545
CountDownLatch latch = new CountDownLatch(1);
4646

4747
CountDownLatch finalLatch = latch;
48-
Callback callback = () -> {
49-
callingCount++;
50-
finalLatch.countDown();
51-
};
48+
Callback callback =
49+
() -> {
50+
callingCount++;
51+
finalLatch.countDown();
52+
};
5253

5354
var task = new SimpleTask();
5455

0 commit comments

Comments
 (0)