0

I am testing database connection and object-relational mapping, but I run to a problem.

I have the same testing class on two different branches. The problem is that on master branch, the test passes, on the feature one, it fails. I need the test to pass on the feature branch.

@SpringBootTest
 public class CodeTableTest {

@Autowired
private CodeTableService codeTableService;

@Autowired
private CodeTableTranslator codeTableTranslator;

@Test
public void shouldLoadSexCodeTable() {
    assertThat(codeTableService.getCodeTableData("SEX")).containsKeys("1", "2");
    assertThat(codeTableTranslator.getDescription("SEX", "1")).isEqualTo("Muž");
}

@Test
public void shouldLoadWorkplaceCodeTable() {
    assertThat(codeTableService.getCodeTableData("WORKPLACE")).containsOnlyKeys(
            IntStream.range(100, 107)
                    .mapToObj(Integer::toString)
                    .toArray(String[]::new));
    assertThat(codeTableTranslator.getDescription("WORKPLACE", "103")).isEqualTo("Masarykovo nám.56, Stříbro, 34901");
    assertThat(codeTableTranslator.getShortDescription("WORKPLACE", "103")).isEqualTo("Stříbro");
    }

}

On master branch, this test passes. However, on feature branch (which was created by mine colleague from different country), the same test fails, due to encoding reasons:

Expecting:
 <"MuĹľ">
to be equal to:
 <"Muž">
but was not.
org.opentest4j.AssertionFailedError: 
Expecting:
 <"MuĹľ">
to be equal to:
 <"Muž">
but was not.
    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at com.generali.gef.demo.mapper.CodeTableTest.shouldLoadSexCodeTable(CodeTableTest.java:25)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:688)
    at org.junit.jupiter.engine.execution.MethodInvocation.proceed(MethodInvocation.java:60)
    at org.junit.jupiter.engine.execution.InvocationInterceptorChain$ValidatingInvocation.proceed(InvocationInterceptorChain.java:131)
    at org.junit.jupiter.engine.extension.TimeoutExtension.intercept(TimeoutExtension.java:149)
    at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestableMethod(TimeoutExtension.java:140)
    at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestMethod(TimeoutExtension.java:84)
    at org.junit.jupiter.engine.execution.ExecutableInvoker$ReflectiveInterceptorCall.lambda$ofVoidMethod$0(ExecutableInvoker.java:115)
    at org.junit.jupiter.engine.execution.ExecutableInvoker.lambda$invoke$0(ExecutableInvoker.java:105)
    at org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:106)
    at org.junit.jupiter.engine.execution.InvocationInterceptorChain.proceed(InvocationInterceptorChain.java:64)
    at org.junit.jupiter.engine.execution.InvocationInterceptorChain.chainAndInvoke(InvocationInterceptorChain.java:45)
    at org.junit.jupiter.engine.execution.InvocationInterceptorChain.invoke(InvocationInterceptorChain.java:37)
    at org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:104)
    at org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:98)
    at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeTestMethod$6(TestMethodTestDescriptor.java:210)
    at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
    at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeTestMethod(TestMethodTestDescriptor.java:206)
    at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:131)
    at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:65)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:139)
    at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:129)
    at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:127)
    at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:126)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:84)
    at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
    at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:38)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:143)
    at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:129)
    at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:127)
    at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:126)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:84)
    at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
    at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:38)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:143)
    at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:129)
    at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:127)
    at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:126)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:84)
    at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:32)
    at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57)
    at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:51)
    at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:108)
    at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:88)
    at org.junit.platform.launcher.core.EngineExecutionOrchestrator.lambda$execute$0(EngineExecutionOrchestrator.java:54)
    at org.junit.platform.launcher.core.EngineExecutionOrchestrator.withInterceptedStreams(EngineExecutionOrchestrator.java:67)
    at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:52)
    at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:96)
    at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:75)
    at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor$CollectAllTestClassesExecutor.processAllTestClasses(JUnitPlatformTestClassProcessor.java:99)
    at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor$CollectAllTestClassesExecutor.access$000(JUnitPlatformTestClassProcessor.java:79)
    at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor.stop(JUnitPlatformTestClassProcessor.java:75)
    at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.stop(SuiteTestClassProcessor.java:61)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:36)
    at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
    at org.gradle.internal.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:33)
    at org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:94)
    at com.sun.proxy.$Proxy5.stop(Unknown Source)
    at org.gradle.api.internal.tasks.testing.worker.TestWorker.stop(TestWorker.java:133)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:36)
    at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
    at org.gradle.internal.remote.internal.hub.MessageHubBackedObjectConnection$DispatchWrapper.dispatch(MessageHubBackedObjectConnection.java:182)
    at org.gradle.internal.remote.internal.hub.MessageHubBackedObjectConnection$DispatchWrapper.dispatch(MessageHubBackedObjectConnection.java:164)
    at org.gradle.internal.remote.internal.hub.MessageHub$Handler.run(MessageHub.java:414)
    at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
    at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56)
    at java.base/java.lang.Thread.run(Thread.java:829)

The second test also fails for the same reasons:

Expecting:
 <"Masarykovo nám.56, Stříbro, 34901">
to be equal to:
 <"Masarykovo nám.56, Stříbro, 34901">
but was not.
org.opentest4j.AssertionFailedError: 
Expecting:
 <"Masarykovo nám.56, Stříbro, 34901">
to be equal to:
 <"Masarykovo nám.56, Stříbro, 34901">
but was not.
    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at com.generali.gef.demo.mapper.CodeTableTest.shouldLoadWorkplaceCodeTable(CodeTableTest.java:33)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:688)
    at org.junit.jupiter.engine.execution.MethodInvocation.proceed(MethodInvocation.java:60)
    at org.junit.jupiter.engine.execution.InvocationInterceptorChain$ValidatingInvocation.proceed(InvocationInterceptorChain.java:131)
    at org.junit.jupiter.engine.extension.TimeoutExtension.intercept(TimeoutExtension.java:149)
    at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestableMethod(TimeoutExtension.java:140)
    at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestMethod(TimeoutExtension.java:84)
    at org.junit.jupiter.engine.execution.ExecutableInvoker$ReflectiveInterceptorCall.lambda$ofVoidMethod$0(ExecutableInvoker.java:115)
    at org.junit.jupiter.engine.execution.ExecutableInvoker.lambda$invoke$0(ExecutableInvoker.java:105)
    at org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:106)
    at org.junit.jupiter.engine.execution.InvocationInterceptorChain.proceed(InvocationInterceptorChain.java:64)
    at org.junit.jupiter.engine.execution.InvocationInterceptorChain.chainAndInvoke(InvocationInterceptorChain.java:45)
    at org.junit.jupiter.engine.execution.InvocationInterceptorChain.invoke(InvocationInterceptorChain.java:37)
    at org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:104)
    at org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:98)
    at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeTestMethod$6(TestMethodTestDescriptor.java:210)
    at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
    at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeTestMethod(TestMethodTestDescriptor.java:206)
    at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:131)
    at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:65)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:139)
    at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:129)
    at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:127)
    at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:126)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:84)
    at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
    at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:38)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:143)
    at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:129)
    at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:127)
    at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:126)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:84)
    at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
    at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:38)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:143)
    at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:129)
    at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:127)
    at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:126)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:84)
    at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:32)
    at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57)
    at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:51)
    at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:108)
    at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:88)
    at org.junit.platform.launcher.core.EngineExecutionOrchestrator.lambda$execute$0(EngineExecutionOrchestrator.java:54)
    at org.junit.platform.launcher.core.EngineExecutionOrchestrator.withInterceptedStreams(EngineExecutionOrchestrator.java:67)
    at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:52)
    at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:96)
    at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:75)
    at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor$CollectAllTestClassesExecutor.processAllTestClasses(JUnitPlatformTestClassProcessor.java:99)
    at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor$CollectAllTestClassesExecutor.access$000(JUnitPlatformTestClassProcessor.java:79)
    at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor.stop(JUnitPlatformTestClassProcessor.java:75)
    at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.stop(SuiteTestClassProcessor.java:61)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:36)
    at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
    at org.gradle.internal.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:33)
    at org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:94)
    at com.sun.proxy.$Proxy5.stop(Unknown Source)
    at org.gradle.api.internal.tasks.testing.worker.TestWorker.stop(TestWorker.java:133)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:36)
    at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
    at org.gradle.internal.remote.internal.hub.MessageHubBackedObjectConnection$DispatchWrapper.dispatch(MessageHubBackedObjectConnection.java:182)
    at org.gradle.internal.remote.internal.hub.MessageHubBackedObjectConnection$DispatchWrapper.dispatch(MessageHubBackedObjectConnection.java:164)
    at org.gradle.internal.remote.internal.hub.MessageHub$Handler.run(MessageHub.java:414)
    at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
    at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56)
    at java.base/java.lang.Thread.run(Thread.java:829)

Now, how do you solve such an issue? I have tried copying and pasting all gradle files, as well as checking for differences in SQL schema and data types, but without success.

Thanks

edit:

The project is for tutorial purposes, The data is filled automatically into the database. The data is inserted correcty, (checked with console and SELECT statement), hovewer, the issue seems to be produced when I try to load the data from the database.

Mine SQL scripts on both branches:

schema.sql

create table policy
(
   id integer not null,
   policy_id integer not null,
   product varchar(255) not null,
   status varchar(255) not null,
   valid_from date,
   valid_to date,
   signed_at NUMBER(10),
   dummy_policy boolean,
   json clob,
   primary key(id)
);

CREATE TABLE ADT_DOMAINS
(
  DOMAIN VARCHAR2(100 BYTE) NOT NULL
, KEY_VALUE VARCHAR2(30 BYTE) NOT NULL
, TEXT VARCHAR2(240 BYTE) NOT NULL
, SHORT_TEXT VARCHAR2(100 BYTE)
, LANG NUMBER(2, 0) DEFAULT 3 NOT NULL
, ORDER_BY NUMBER(10, 0) NOT NULL
, VALID_FROM DATE
, VALID_TILL DATE
, DATE_CREATED TIMESTAMP(6) DEFAULT systimestamp
, USER_CREATED NUMBER(10, 0)
, DATE_MODIFIED TIMESTAMP(6)
, USER_MODIFIED NUMBER(10, 0)
, COMPANY_ID NUMBER(3, 0) NOT NULL
);

CREATE TABLE WORKPLACE
(
  WORKPLACE_ID NUMBER(10) NOT NULL,
  CITY VARCHAR2(150 BYTE),
  STREET VARCHAR2(150 BYTE),
  ZIP_CODE VARCHAR2(10 BYTE),
  AGENCY_ID NUMBER(3)
);

data.sql

insert into policy
values(10001, 603586, 'PMV', 'D', '2019-06-27', '2020-06-27', 101, false, '{
   "name":"Brandon Goodin",
   "birthDate":"1992-06-27"
}');

insert into policy
values(10002, 603587, 'MAJ', 'DX', '2013-05-14', '2018-06-27', 104, true, '{
  "name":"Christian Poitras",
   "birthDate":"1985-03-18"
}');

Insert into ADT_DOMAINS (DOMAIN,KEY_VALUE,TEXT,SHORT_TEXT,LANG,ORDER_BY,VALID_FROM,VALID_TILL,DATE_CREATED,USER_CREATED,DATE_MODIFIED,USER_MODIFIED,COMPANY_ID)
values ('SEX','1','Muž','Muž','3','1',to_date('01.01.04','DD.MM.RR'),null,to_timestamp('25.01.05 14:33:05,035149000','DD.MM.RR HH24:MI:SSXFF'),null,null,null,'1');

Insert into ADT_DOMAINS (DOMAIN,KEY_VALUE,TEXT,SHORT_TEXT,LANG,ORDER_BY,VALID_FROM,VALID_TILL,DATE_CREATED,USER_CREATED,DATE_MODIFIED,USER_MODIFIED,COMPANY_ID)
values ('SEX','2','Žena','Žena','3','2',to_date('01.01.04','DD.MM.RR'),null,to_timestamp('25.01.05 14:33:05,054860000','DD.MM.RR HH24:MI:SSXFF'),null,null,null,'1');


insert into WORKPLACE (WORKPLACE_ID, CITY, STREET, ZIP_CODE, AGENCY_ID)
values (100,    'Brno', 'Hlavní 15/140',    '62400',    633);

insert into WORKPLACE (WORKPLACE_ID, CITY, STREET, ZIP_CODE, AGENCY_ID)
values (101,    'Poděbrady', 'Fugnerova 28',    '29001',    138);

insert into WORKPLACE (WORKPLACE_ID, CITY, STREET, ZIP_CODE, AGENCY_ID)
values (102,    'Louny', '17.listopadu 2071',   '44001',    437);

insert into WORKPLACE (WORKPLACE_ID, CITY, STREET, ZIP_CODE, AGENCY_ID)
values (103,    'Stříbro', 'Masarykovo nám.56', '34901',    340);

insert into WORKPLACE (WORKPLACE_ID, CITY, STREET, ZIP_CODE, AGENCY_ID)
values (104,    'Poděbrady', 'Fugnerova 28',    '29001',    138);

insert into WORKPLACE (WORKPLACE_ID, CITY, STREET, ZIP_CODE, AGENCY_ID)
values (105,    'Šumperk', 'Generála Svobody 45/16',    '78969',    739);

insert into WORKPLACE (WORKPLACE_ID, CITY, STREET, ZIP_CODE, AGENCY_ID)
values (106,    'Praha 5', 'Stroupežnického 30',    '15000',    140);
Mark
  • 73
  • 2
  • 9
  • How do you fill the database with data for tests? – Kayaman Nov 24 '21 at 11:28
  • why do you think it is an encoding problem? It could be that someone updated the branch data queries, and added "MuĹľ" instead. To me "MuĹľ" does not seem like "Muž" . How about you search in your branch through your database files for the text "Mu" and see what you get. – JCompetence Nov 24 '21 at 11:32
  • If you are testing your code against databases that are different, then it's probably going to produce different results. Make sure the databases are created in the same way. Store the DDL in the source code repository, so there's only one source of truth for the database model. – The Impaler Nov 24 '21 at 11:33
  • What are you using to open and read data.sql? Also what encoding do you expect it to be, UTF-8 or something else? – Kayaman Nov 24 '21 at 12:09
  • @Kayaman It is done automatically, but I don't know which tool does it (I just started my first programming job). But only thing I know is that it works on one branch, but does not work on another. The SQL script is the same on both branches, and they are very similar. The data inserting works correctly on both branches – Mark Nov 24 '21 at 12:41
  • 1
    I meant what editor are you using to observe `data.sql`. The problem most likely occurs before the data is in the database. You're just reading what broken data you've written in the DB, but an editor may be "helpful" by switching encodings or there may be some other problem that is invisible to your eyes. You would need to examine bytes to see where you're having mixed encodings. – Kayaman Nov 24 '21 at 13:06
  • Well, I know for sure that the problem is not caused by inserting wrong data. I am able to check it after the script is run by simple SELECT statement - the data inside the database match the script. The problem is getting the data from the database. – Mark Nov 24 '21 at 13:27

1 Answers1

1

This doesn't seem to be an encoding issue. Rather, it is a naming conflict of the SEX parameter between your two branches.

Relying on google translate ( from Czech to English ) , Muž and MuĹI' both mean Man.

Double check SEX value in the branch diff. Or SEX column in database diff if you are switching databases between the two branches.

EDIT: It is an encoding issue

Try :

  1. Database issue

Try getting the character set from your database. See this question for full options provided.

If the character set is not utf-8, you can see this post to alter it.

If the character set is all good in the database itself, and select statement provided correct data with the proper encoding, you can go to step 2.

  1. Application issue

Try setting the encoding in the connection URL property :

spring.datasource.url = jdbc:mysql://localhost:3306/gehive?useUnicode=yes&characterEncoding=UTF-8

# or this if you are using Hikari pools
#spring.datasource.hikari.data-source-properties.useUnicode=true
#spring.datasource.hikari.data-source-properties.characterEncoding=UTF-8 

See related JPA datsource encoding issue here

exaucae
  • 2,071
  • 1
  • 14
  • 24
  • The script which inserts the data is all good. Even the data gets inserted correctly. (checked with SQL statement). However, when I try to get it from the database, it does not work. MuĹľ does not mean anything, Muž does (Man in english). – Mark Nov 24 '21 at 11:57
  • @exaucae Don't get fooled by [Mojibake](https://en.wikipedia.org/wiki/Mojibake). – Kayaman Nov 24 '21 at 12:08
  • @Vaclav, can you update your answer with the output when you only run the second test named "shouldLoadWorkplaceCodeTable"? If it's an encoding issue, it should fail and suggest a different name in the assertion. Thus will be able to detect a failing pattern with those special characters. – exaucae Nov 24 '21 at 12:25
  • @exacuae done, but I can't just rename the assertion value, that would destroy the purpose of testing – Mark Nov 24 '21 at 12:35
  • Thanks @Vaclav. It 's an encoding issue. We do not have to touch test cases. Two possibilities, either the database encoding is not correct or Spring JPA encoding did not default to UTF8. Can you try to enforce both of them and output the result? I have update my answer. – exaucae Nov 24 '21 at 16:22