[INFO] Scanning for projects...
[INFO] 
[INFO] ------------------< com.homannsoftware:modulith-ddd >-------------------
[INFO] Building modulith-ddd 1.0.0
[INFO]   from pom.xml
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- resources:3.5.0:resources (default-resources) @ modulith-ddd ---
[INFO] Copying 1 resource from src\main\resources to target\classes
[INFO] Copying 1 resource from src\main\resources to target\classes
[INFO] 
[INFO] --- compiler:3.15.0:compile (default-compile) @ modulith-ddd ---
[INFO] Recompiling the module because of changed source code.
[INFO] Compiling 8 source files with javac [debug parameters release 21] to target\classes
[INFO] Die Annotationsverarbeitung ist aktiviert, da mindestens ein Prozessor im
  Classpath gefunden wurde. In einem zuk�nftigen Release von javac kann die Annotationsverarbeitung deaktiviert werden,
  es sei denn, mindestens ein Prozessor ist namentlich angegeben (-processor), oder ein Suchpfad
  ist angegeben (--processor-path, --processor-module-path), oder die Annotationsverarbeitung
  wurde explizit aktiviert (-proc:only, -proc:full).
  Verwenden Sie "-Xlint:-options", um diese Meldung zu unterdr�cken.
  Verwenden Sie "-proc:none", um die Annotationsverarbeitung zu deaktivieren.
[INFO] Extracting Javadoc into D:\CodexProjects\homannsoftware_com\blog\2026-10-09-spring-modulith-ddd\examples\.\target\generated-spring-modulith\javadoc.json.
[INFO] 
[INFO] --- resources:3.5.0:testResources (default-testResources) @ modulith-ddd ---
[INFO] skip non existing resourceDirectory D:\CodexProjects\homannsoftware_com\blog\2026-10-09-spring-modulith-ddd\examples\src\test\resources
[INFO] 
[INFO] --- compiler:3.15.0:testCompile (default-testCompile) @ modulith-ddd ---
[INFO] Recompiling the module because of changed dependency.
[INFO] Compiling 4 source files with javac [debug parameters release 21] to target\test-classes
[INFO] Die Annotationsverarbeitung ist aktiviert, da mindestens ein Prozessor im
  Classpath gefunden wurde. In einem zuk�nftigen Release von javac kann die Annotationsverarbeitung deaktiviert werden,
  es sei denn, mindestens ein Prozessor ist namentlich angegeben (-processor), oder ein Suchpfad
  ist angegeben (--processor-path, --processor-module-path), oder die Annotationsverarbeitung
  wurde explizit aktiviert (-proc:only, -proc:full).
  Verwenden Sie "-Xlint:-options", um diese Meldung zu unterdr�cken.
  Verwenden Sie "-proc:none", um die Annotationsverarbeitung zu deaktivieren.
[INFO] 
[INFO] --- surefire:3.5.6:test (default-test) @ modulith-ddd ---
[INFO] Using auto detected provider org.apache.maven.surefire.junitplatform.JUnitPlatformProvider
[INFO] 
[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[INFO] Running com.homannsoftware.shop.EventIntegrationTest
12:39:04.259 [main] INFO org.springframework.test.context.support.AnnotationConfigContextLoaderUtils -- Could not detect default configuration classes for test class [com.homannsoftware.shop.EventIntegrationTest]: EventIntegrationTest does not declare any static, non-private, non-final, nested classes annotated with @Configuration.
12:39:04.380 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper -- Found @SpringBootConfiguration com.homannsoftware.shop.ShopApplication for test class com.homannsoftware.shop.EventIntegrationTest
12:39:04.470 [main] INFO org.springframework.test.context.support.AnnotationConfigContextLoaderUtils -- Could not detect default configuration classes for test class [com.homannsoftware.shop.EventIntegrationTest]: EventIntegrationTest does not declare any static, non-private, non-final, nested classes annotated with @Configuration.
12:39:04.472 [main] INFO org.springframework.boot.test.context.SpringBootTestContextBootstrapper -- Found @SpringBootConfiguration com.homannsoftware.shop.ShopApplication for test class com.homannsoftware.shop.EventIntegrationTest

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/

 :: Spring Boot ::                (v4.1.0)

2026-10-09T12:39:04.793+02:00  INFO 56056 --- [           main] c.h.shop.EventIntegrationTest            : Starting EventIntegrationTest using Java 21.0.11 with PID 56056 (started by enrico in D:\CodexProjects\homannsoftware_com\blog\2026-10-09-spring-modulith-ddd\examples)
2026-10-09T12:39:04.794+02:00  INFO 56056 --- [           main] c.h.shop.EventIntegrationTest            : No active profile set, falling back to 1 default profile: "default"
2026-10-09T12:39:05.460+02:00  INFO 56056 --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Starting...
2026-10-09T12:39:05.678+02:00  INFO 56056 --- [           main] com.zaxxer.hikari.pool.HikariPool        : HikariPool-1 - Added connection conn0: url=jdbc:h2:mem:shop user=SA
2026-10-09T12:39:05.681+02:00  INFO 56056 --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Start completed.
2026-10-09T12:39:06.021+02:00  INFO 56056 --- [           main] o.s.s.config.TaskSchedulerRouter         : No TaskScheduler/ScheduledExecutorService bean found for scheduled processing
2026-10-09T12:39:06.031+02:00  INFO 56056 --- [           main] c.h.shop.EventIntegrationTest            : Started EventIntegrationTest in 1.501 seconds (process running for 2.627)
Mockito is currently self-attaching to enable the inline-mock-maker. This will no longer work in future releases of the JDK. Please add Mockito as an agent to your build as described in Mockito's documentation: https://javadoc.io/doc/org.mockito/mockito-core/latest/org.mockito/org/mockito/Mockito.html#0.3
OpenJDK 64-Bit Server VM warning: Sharing is only supported for boot loader classes because bootstrap classpath has been appended
WARNING: A Java agent has been loaded dynamically (C:\Users\enrico\.m2\repository\net\bytebuddy\byte-buddy-agent\1.18.10\byte-buddy-agent-1.18.10.jar)
WARNING: If a serviceability tool is in use, please run with -XX:+EnableDynamicAgentLoading to hide this warning
WARNING: If a serviceability tool is not in use, please run with -Djdk.instrument.traceUsage for more information
WARNING: Dynamic loading of agents will be disallowed by default in a future release
2026-10-09T12:39:07.238+02:00  INFO 56056 --- [         task-2] r$CompletionRegisteringMethodInterceptor : Invocation of listener public void com.homannsoftware.shop.billing.internal.InvoiceListener.on(com.homannsoftware.shop.orders.events.OrderConfirmed) failed with message PreparedStatementCallback; SQL [INSERT INTO invoices (event_id, order_id, total_cents) VALUES (?, ?, ?)]; Eindeutiger Index oder Prim�rschl�ssel verletzt: "PUBLIC.CONSTRAINT_5 INDEX PUBLIC.PRIMARY_KEY_5 ON PUBLIC.INVOICES(EVENT_ID) VALUES ( /* 1 */ UUID '0d608f02-9625-4c60-8a84-b4cd84622a2a' )"
Unique index or primary key violation: "PUBLIC.CONSTRAINT_5 INDEX PUBLIC.PRIMARY_KEY_5 ON PUBLIC.INVOICES(EVENT_ID) VALUES ( /* 1 */ UUID '0d608f02-9625-4c60-8a84-b4cd84622a2a' )"; SQL statement:
INSERT INTO invoices (event_id, order_id, total_cents) VALUES (?, ?, ?) [23505-240]. Leaving event publication uncompleted.
2026-10-09T12:39:07.239+02:00 ERROR 56056 --- [         task-2] .a.i.SimpleAsyncUncaughtExceptionHandler : Unexpected exception occurred invoking async method: public void com.homannsoftware.shop.billing.internal.InvoiceListener.on(com.homannsoftware.shop.orders.events.OrderConfirmed)

org.springframework.dao.DuplicateKeyException: PreparedStatementCallback; SQL [INSERT INTO invoices (event_id, order_id, total_cents) VALUES (?, ?, ?)]; Eindeutiger Index oder Prim�rschl�ssel verletzt: "PUBLIC.CONSTRAINT_5 INDEX PUBLIC.PRIMARY_KEY_5 ON PUBLIC.INVOICES(EVENT_ID) VALUES ( /* 1 */ UUID '0d608f02-9625-4c60-8a84-b4cd84622a2a' )"
Unique index or primary key violation: "PUBLIC.CONSTRAINT_5 INDEX PUBLIC.PRIMARY_KEY_5 ON PUBLIC.INVOICES(EVENT_ID) VALUES ( /* 1 */ UUID '0d608f02-9625-4c60-8a84-b4cd84622a2a' )"; SQL statement:
INSERT INTO invoices (event_id, order_id, total_cents) VALUES (?, ?, ?) [23505-240]
	at org.springframework.jdbc.support.SQLExceptionSubclassTranslator.doTranslate(SQLExceptionSubclassTranslator.java:104) ~[spring-jdbc-7.0.8.jar:7.0.8]
	at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:102) ~[spring-jdbc-7.0.8.jar:7.0.8]
	at org.springframework.jdbc.core.JdbcTemplate.translateException(JdbcTemplate.java:1549) ~[spring-jdbc-7.0.8.jar:7.0.8]
	at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:689) ~[spring-jdbc-7.0.8.jar:7.0.8]
	at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:966) ~[spring-jdbc-7.0.8.jar:7.0.8]
	at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:987) ~[spring-jdbc-7.0.8.jar:7.0.8]
	at org.springframework.jdbc.core.simple.DefaultJdbcClient$DefaultStatementSpec.update(DefaultJdbcClient.java:282) ~[spring-jdbc-7.0.8.jar:7.0.8]
	at com.homannsoftware.shop.billing.internal.InvoiceListener.on(InvoiceListener.java:14) ~[classes/:na]
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103) ~[na:na]
	at java.base/java.lang.reflect.Method.invoke(Method.java:580) ~[na:na]
	at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:359) ~[spring-aop-7.0.8.jar:7.0.8]
	at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190) ~[spring-aop-7.0.8.jar:7.0.8]
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:158) ~[spring-aop-7.0.8.jar:7.0.8]
	at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:133) ~[spring-tx-7.0.8.jar:7.0.8]
	at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:371) ~[spring-tx-7.0.8.jar:7.0.8]
	at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:130) ~[spring-tx-7.0.8.jar:7.0.8]
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-7.0.8.jar:7.0.8]
	at org.springframework.modulith.events.support.CompletionRegisteringAdvisor$CompletionRegisteringMethodInterceptor.invoke(CompletionRegisteringAdvisor.java:174) ~[spring-modulith-events-core-2.1.1.jar:2.1.1]
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-7.0.8.jar:7.0.8]
	at org.springframework.aop.interceptor.AsyncExecutionInterceptor.lambda$invoke$0(AsyncExecutionInterceptor.java:112) ~[spring-aop-7.0.8.jar:7.0.8]
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317) ~[na:na]
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144) ~[na:na]
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642) ~[na:na]
	at java.base/java.lang.Thread.run(Thread.java:1583) ~[na:na]
Caused by: org.h2.jdbc.JdbcSQLIntegrityConstraintViolationException: Eindeutiger Index oder Prim�rschl�ssel verletzt: "PUBLIC.CONSTRAINT_5 INDEX PUBLIC.PRIMARY_KEY_5 ON PUBLIC.INVOICES(EVENT_ID) VALUES ( /* 1 */ UUID '0d608f02-9625-4c60-8a84-b4cd84622a2a' )"
Unique index or primary key violation: "PUBLIC.CONSTRAINT_5 INDEX PUBLIC.PRIMARY_KEY_5 ON PUBLIC.INVOICES(EVENT_ID) VALUES ( /* 1 */ UUID '0d608f02-9625-4c60-8a84-b4cd84622a2a' )"; SQL statement:
INSERT INTO invoices (event_id, order_id, total_cents) VALUES (?, ?, ?) [23505-240]
	at org.h2.message.DbException.getJdbcSQLException(DbException.java:520) ~[h2-2.4.240.jar:2.4.240]
	at org.h2.message.DbException.getJdbcSQLException(DbException.java:489) ~[h2-2.4.240.jar:2.4.240]
	at org.h2.message.DbException.get(DbException.java:223) ~[h2-2.4.240.jar:2.4.240]
	at org.h2.message.DbException.get(DbException.java:199) ~[h2-2.4.240.jar:2.4.240]
	at org.h2.index.Index.getDuplicateKeyException(Index.java:535) ~[h2-2.4.240.jar:2.4.240]
	at org.h2.mvstore.db.MVSecondaryIndex.checkUnique(MVSecondaryIndex.java:223) ~[h2-2.4.240.jar:2.4.240]
	at org.h2.mvstore.db.MVSecondaryIndex.add(MVSecondaryIndex.java:184) ~[h2-2.4.240.jar:2.4.240]
	at org.h2.mvstore.db.MVTable.addRow(MVTable.java:520) ~[h2-2.4.240.jar:2.4.240]
	at org.h2.command.dml.Insert.insertRows(Insert.java:174) ~[h2-2.4.240.jar:2.4.240]
	at org.h2.command.dml.Insert.update(Insert.java:135) ~[h2-2.4.240.jar:2.4.240]
	at org.h2.command.dml.DataChangeStatement.update(DataChangeStatement.java:77) ~[h2-2.4.240.jar:2.4.240]
	at org.h2.command.CommandContainer.update(CommandContainer.java:139) ~[h2-2.4.240.jar:2.4.240]
	at org.h2.command.Command.executeUpdate(Command.java:306) ~[h2-2.4.240.jar:2.4.240]
	at org.h2.command.Command.executeUpdate(Command.java:250) ~[h2-2.4.240.jar:2.4.240]
	at org.h2.jdbc.JdbcPreparedStatement.executeUpdateInternal(JdbcPreparedStatement.java:213) ~[h2-2.4.240.jar:2.4.240]
	at org.h2.jdbc.JdbcPreparedStatement.executeUpdate(JdbcPreparedStatement.java:172) ~[h2-2.4.240.jar:2.4.240]
	at com.zaxxer.hikari.pool.ProxyPreparedStatement.executeUpdate(ProxyPreparedStatement.java:61) ~[HikariCP-7.0.2.jar:na]
	at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.executeUpdate(HikariProxyPreparedStatement.java) ~[HikariCP-7.0.2.jar:na]
	at org.springframework.jdbc.core.JdbcTemplate.lambda$update$0(JdbcTemplate.java:971) ~[spring-jdbc-7.0.8.jar:7.0.8]
	at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:670) ~[spring-jdbc-7.0.8.jar:7.0.8]
	... 20 common frames omitted

[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 13.26 s <<< FAILURE! -- in com.homannsoftware.shop.EventIntegrationTest
[ERROR] com.homannsoftware.shop.EventIntegrationTest.duplicateDeliveryKeepsSingleInvoice -- Time elapsed: 11.28 s <<< ERROR!
org.awaitility.core.ConditionTimeoutException: 
Assertion condition defined as a Lambda expression in com.homannsoftware.shop.EventIntegrationTest 
expected: 2L
 but was: 1L within 10 seconds.
	at org.awaitility.core.ConditionAwaiter.await(ConditionAwaiter.java:167)
	at org.awaitility.core.AssertionCondition.await(AssertionCondition.java:119)
	at org.awaitility.core.AssertionCondition.await(AssertionCondition.java:31)
	at org.awaitility.core.ConditionFactory.until(ConditionFactory.java:1160)
	at org.awaitility.core.ConditionFactory.untilAsserted(ConditionFactory.java:790)
	at com.homannsoftware.shop.EventIntegrationTest.duplicateDeliveryKeepsSingleInvoice(EventIntegrationTest.java:47)
Caused by: org.opentest4j.AssertionFailedError: 
expected: 2L
 but was: 1L
	at com.homannsoftware.shop.EventIntegrationTest.lambda$duplicateDeliveryKeepsSingleInvoice$4(EventIntegrationTest.java:48)

[INFO] 
[INFO] Results:
[INFO] 
[ERROR] Errors: 
[ERROR]   EventIntegrationTest.duplicateDeliveryKeepsSingleInvoice:47 � ConditionTimeout Assertion condition defined as a Lambda expression in com.homannsoftware.shop.EventIntegrationTest 
expected: 2L
 but was: 1L within 10 seconds.
[INFO] 
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0
[INFO] 
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  18.766 s
[INFO] Finished at: 2026-10-09T12:39:17+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:3.5.6:test (default-test) on project modulith-ddd: 
[ERROR] 
[ERROR] See D:\CodexProjects\homannsoftware_com\blog\2026-10-09-spring-modulith-ddd\examples\target\surefire-reports for the individual test results.
[ERROR] See dump files (if any exist) [date].dump, [date]-jvmRun[N].dump and [date].dumpstream.
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
