From 9d63cfe4a6860f31ff641557ae416eaf40282e7e Mon Sep 17 00:00:00 2001 From: Dhawal Kapil Date: Sun, 21 May 2023 15:33:22 +0530 Subject: [PATCH] JAVA-21440 Minor cleanup (#14084) --- .../src/main/java/com/baeldung/jooby/App.java | 26 +++++-------------- .../java/com/baeldung/jooby/AppLiveTest.java | 4 +-- 2 files changed, 9 insertions(+), 21 deletions(-) diff --git a/web-modules/jooby/src/main/java/com/baeldung/jooby/App.java b/web-modules/jooby/src/main/java/com/baeldung/jooby/App.java index 87899944ee..1bfaf6de5d 100644 --- a/web-modules/jooby/src/main/java/com/baeldung/jooby/App.java +++ b/web-modules/jooby/src/main/java/com/baeldung/jooby/App.java @@ -6,9 +6,6 @@ import io.jooby.Jooby; import io.jooby.ServerOptions; import io.jooby.Session; import io.jooby.SessionStore; -import io.jooby.redis.RedisModule; -import io.jooby.redis.RedisSessionStore; -import io.lettuce.core.RedisClient; public class App extends Jooby { { @@ -16,7 +13,6 @@ public class App extends Jooby { .setSecurePort(8433)); } - { get("/", ctx -> "Hello World!"); } @@ -31,17 +27,11 @@ public class App extends Jooby { } { - onStarting(() -> { - System.out.println("starting app"); - }); + onStarting(() -> System.out.println("starting app")); - onStop(() -> { - System.out.println("stopping app"); - }); + onStop(() -> System.out.println("stopping app")); - onStarted(() -> { - System.out.println("app started"); - }); + onStarted(() -> System.out.println("app started")); } { @@ -63,13 +53,12 @@ public class App extends Jooby { post("/submitForm", ctx -> { Employee employee = ctx.path(Employee.class); - // TODO + // ... return "employee data saved successfully"; }); } - { decorator(next -> ctx -> { System.out.println("first"); @@ -82,9 +71,7 @@ public class App extends Jooby { return next.apply(ctx); }); - get("/handler", ctx -> { - return "third"; - }); + get("/handler", ctx -> "third"); } { @@ -104,7 +91,8 @@ public class App extends Jooby { get("/signedSession", ctx -> { Session session = ctx.session(); session.put("token", "value"); - return session.get("token").value(); + return session.get("token") + .value(); }); } diff --git a/web-modules/jooby/src/test/java/com/baeldung/jooby/AppLiveTest.java b/web-modules/jooby/src/test/java/com/baeldung/jooby/AppLiveTest.java index 18a505b406..e55e0e04a4 100644 --- a/web-modules/jooby/src/test/java/com/baeldung/jooby/AppLiveTest.java +++ b/web-modules/jooby/src/test/java/com/baeldung/jooby/AppLiveTest.java @@ -12,12 +12,12 @@ import okhttp3.Request; import okhttp3.Response; @JoobyTest(value = App.class, port = 8080) -public class AppLiveTest { +class AppLiveTest { static OkHttpClient client = new OkHttpClient(); @Test - public void given_defaultUrl_expect_fixedString() { + void given_defaultUrl_expect_fixedString() { Request request = new Request.Builder().url("http://localhost:8080") .build(); try (Response response = client.newCall(request)