diff --git a/pom.xml b/pom.xml
index c4c4a4d..4795c70 100644
--- a/pom.xml
+++ b/pom.xml
@@ -117,6 +117,12 @@
${javax.validation.version}
+
+ javax.inject
+ javax.inject
+ 1
+
+
io.jooby
diff --git a/src/test/java/com/github/polpetta/mezzotre/telegram/command/StartIntegrationTest.java b/src/test/java/com/github/polpetta/mezzotre/telegram/command/StartIntegrationTest.java
index 4a3691a..c2b4cbf 100644
--- a/src/test/java/com/github/polpetta/mezzotre/telegram/command/StartIntegrationTest.java
+++ b/src/test/java/com/github/polpetta/mezzotre/telegram/command/StartIntegrationTest.java
@@ -1,8 +1,5 @@
package com.github.polpetta.mezzotre.telegram.command;
-import static org.junit.jupiter.api.Assertions.*;
-import static org.mockito.Mockito.*;
-
import com.github.polpetta.mezzotre.helper.Loader;
import com.github.polpetta.mezzotre.helper.TestConfig;
import com.github.polpetta.mezzotre.i18n.LocalizedMessageFactory;
@@ -14,9 +11,6 @@ import com.pengrad.telegrambot.model.Update;
import com.pengrad.telegrambot.request.BaseRequest;
import com.pengrad.telegrambot.request.SendMessage;
import io.ebean.Database;
-import java.util.Optional;
-import java.util.concurrent.CompletableFuture;
-import java.util.concurrent.Executors;
import org.apache.velocity.app.VelocityEngine;
import org.apache.velocity.runtime.RuntimeConstants;
import org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader;
@@ -30,6 +24,12 @@ import org.testcontainers.containers.PostgreSQLContainer;
import org.testcontainers.junit.jupiter.Container;
import org.testcontainers.junit.jupiter.Testcontainers;
+import java.util.Optional;
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.Executors;
+
+import static org.junit.jupiter.api.Assertions.*;
+
@Tag("slow")
@Tag("database")
@Tag("velocity")
@@ -71,31 +71,33 @@ class StartIntegrationTest {
@Test
void shouldUpdateContextInTheDatabase() throws Exception {
final TgChat tgChat = new TgChat(1111111L, new ChatContext());
+ tgChat.setLocale("en-US");
tgChat.save();
final Update update =
gson.fromJson(
- "{\n"
- + "\"update_id\":10000,\n"
- + "\"message\":{\n"
- + " \"date\":1441645532,\n"
- + " \"chat\":{\n"
- + " \"last_name\":\"Test Lastname\",\n"
- + " \"id\":1111111,\n"
- + " \"type\": \"private\",\n"
- + " \"first_name\":\"Test Firstname\",\n"
- + " \"username\":\"Testusername\"\n"
- + " },\n"
- + " \"message_id\":1365,\n"
- + " \"from\":{\n"
- + " \"last_name\":\"Test Lastname\",\n"
- + " \"id\":1111111,\n"
- + " \"first_name\":\"Test Firstname\",\n"
- + " \"username\":\"Testusername\"\n"
- + " },\n"
- + " \"text\":\"/start\"\n"
- + "}\n"
- + "}",
+ """
+{
+"update_id":10000,
+"message":{
+ "date":1441645532,
+ "chat":{
+ "last_name":"Test Lastname",
+ "id":1111111,
+ "type": "private",
+ "first_name":"Test Firstname",
+ "username":"Testusername"
+ },
+ "message_id":1365,
+ "from":{
+ "last_name":"Test Lastname",
+ "id":1111111,
+ "first_name":"Test Firstname",
+ "username":"Testusername"
+ },
+ "text":"/start"
+}
+}""",
Update.class);
final CompletableFuture>> gotFuture = start.process(tgChat, update);
diff --git a/src/test/java/com/github/polpetta/mezzotre/telegram/command/StartTest.java b/src/test/java/com/github/polpetta/mezzotre/telegram/command/StartTest.java
index 6f80312..7130d8c 100644
--- a/src/test/java/com/github/polpetta/mezzotre/telegram/command/StartTest.java
+++ b/src/test/java/com/github/polpetta/mezzotre/telegram/command/StartTest.java
@@ -1,8 +1,5 @@
package com.github.polpetta.mezzotre.telegram.command;
-import static org.junit.jupiter.api.Assertions.*;
-import static org.mockito.Mockito.*;
-
import com.github.polpetta.mezzotre.i18n.LocalizedMessageFactory;
import com.github.polpetta.mezzotre.orm.model.TgChat;
import com.github.polpetta.types.json.ChatContext;
@@ -10,18 +7,24 @@ import com.google.gson.Gson;
import com.pengrad.telegrambot.model.Update;
import com.pengrad.telegrambot.request.BaseRequest;
import com.pengrad.telegrambot.request.SendMessage;
+import org.apache.velocity.app.VelocityEngine;
+import org.apache.velocity.runtime.RuntimeConstants;
+import org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Tag;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.parallel.Execution;
+import org.junit.jupiter.api.parallel.ExecutionMode;
+import org.slf4j.Logger;
+
import java.util.Optional;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Executors;
-import org.apache.velocity.app.VelocityEngine;
-import org.apache.velocity.runtime.RuntimeConstants;
-import org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader;
-import org.junit.jupiter.api.BeforeAll;import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Tag;import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.parallel.Execution;
-import org.junit.jupiter.api.parallel.ExecutionMode;
-import org.slf4j.Logger;
+
+import static org.junit.jupiter.api.Assertions.*;
+import static org.mockito.Mockito.*;
@Tag("velocity")
@Execution(ExecutionMode.CONCURRENT)
@@ -52,33 +55,34 @@ class StartTest {
@Test
void shouldReceiveHelloIntroduction() throws Exception {
final TgChat fakeChat = mock(TgChat.class);
- when(fakeChat.getLocale()).thenReturn("en");
+ when(fakeChat.getLocale()).thenReturn("en-US");
when(fakeChat.getChatContext()).thenReturn(new ChatContext());
when(fakeChat.getId()).thenReturn(1111111L);
final Update update =
gson.fromJson(
- "{\n"
- + "\"update_id\":10000,\n"
- + "\"message\":{\n"
- + " \"date\":1441645532,\n"
- + " \"chat\":{\n"
- + " \"last_name\":\"Test Lastname\",\n"
- + " \"id\":1111111,\n"
- + " \"type\": \"private\",\n"
- + " \"first_name\":\"Test Firstname\",\n"
- + " \"username\":\"Testusername\"\n"
- + " },\n"
- + " \"message_id\":1365,\n"
- + " \"from\":{\n"
- + " \"last_name\":\"Test Lastname\",\n"
- + " \"id\":1111111,\n"
- + " \"first_name\":\"Test Firstname\",\n"
- + " \"username\":\"Testusername\"\n"
- + " },\n"
- + " \"text\":\"/start\"\n"
- + "}\n"
- + "}",
+ """
+{
+"update_id":10000,
+"message":{
+ "date":1441645532,
+ "chat":{
+ "last_name":"Test Lastname",
+ "id":1111111,
+ "type": "private",
+ "first_name":"Test Firstname",
+ "username":"Testusername"
+ },
+ "message_id":1365,
+ "from":{
+ "last_name":"Test Lastname",
+ "id":1111111,
+ "first_name":"Test Firstname",
+ "username":"Testusername"
+ },
+ "text":"/start"
+}
+}""",
Update.class);
final CompletableFuture>> gotFuture =