title: java.lang.AssertionError: expectation "expectComplete" failed (expected: onComplete(); actual: onError(org.springframework.r2dbc.BadSqlGrammarExceptio
body: <p>I am using Spring Boot 2.7.0 and looking to</p>
  <ol>
  <li>Read application-test.properties to create H2 DB while running the test cases only</li>
  <li></li>
  </ol>
  <p>Error:</p>
  <pre><code>java.lang.AssertionError: expectation &quot;expectComplete&quot; failed (expected: onComplete(); actual: onError(org.springframework.r2dbc.BadSqlGrammarException: execute; bad SQL grammar [create table account (
      id INT auto_increment,
      user_name VARCHAR(50),
      balance INT
  );
  
  create table money_deposit_event (
      id INT auto_increment,
      account_number INT,
      amount INT,
      foreign key (account_number) references account(id),
      check (amount &gt; 99) -- business rule says there should be min $100 deposit
  );
  
  insert into account (user_name, balance) values
       ('Tara', 0),
       ('Daisy', 0),
       ('Fredericka', 0),
       ('Brita', 0);]; nested exception is io.r2dbc.spi.R2dbcBadGrammarException: [90057] [90057] Constraint &quot;PRIMARY KEY | UNIQUE (ID)&quot; not found; SQL statement:
  create table money_deposit_event (
      id INT auto_increment,
      account_number INT,
      amount INT,
      foreign key (account_number) references account(id),
      check (amount &gt; 99) -- business rule says there should be min $100 deposit
  ) [90057-212]))
      at reactor.test.MessageFormatter.assertionError(MessageFormatter.java:115)
      at reactor.test.MessageFormatter.failPrefix(MessageFormatter.java:104)
      at reactor.test.MessageFormatter.fail(MessageFormatter.java:73)
      at reactor.test.MessageFormatter.failOptional(MessageFormatter.java:88)
      at reactor.test.DefaultStepVerifierBuilder.lambda$expectComplete$4(DefaultStepVerifierBuilder.java:336)
      at reactor.test.DefaultStepVerifierBuilder$SignalEvent.test(DefaultStepVerifierBuilder.java:2218)
      at reactor.test.DefaultStepVerifierBuilder$DefaultVerifySubscriber.onSignal(DefaultStepVerifierBuilder.java:1490)
      at reactor.test.DefaultStepVerifierBuilder$DefaultVerifySubscriber.onExpectation(DefaultStepVerifierBuilder.java:1438)
      at reactor.test.DefaultStepVerifierBuilder$DefaultVerifySubscriber.onError(DefaultStepVerifierBuilder.java:1091)
      at reactor.core.publisher.MonoIgnoreElements$IgnoreElementsSubscriber.onError(MonoIgnoreElements.java:84)
      at reactor.core.publisher.FluxOnErrorResume$ResumeSubscriber.onError(FluxOnErrorResume.java:106)
      at reactor.core.publisher.Operators.error(Operators.java:198)
      at reactor.core.publisher.MonoError.subscribe(MonoError.java:53)
      at reactor.core.publisher.Mono.subscribe(Mono.java:4400)
      at reactor.core.publisher.FluxOnErrorResume$ResumeSubscriber.onError(FluxOnErrorResume.java:103)
      at reactor.core.publisher.MonoUsingWhen$MonoUsingWhenSubscriber.deferredError(MonoUsingWhen.java:277)
      at reactor.core.publisher.FluxUsingWhen$RollbackInner.onComplete(FluxUsingWhen.java:475)
      at reactor.core.publisher.Operators$MultiSubscriptionSubscriber.onComplete(Operators.java:2058)
      at reactor.core.publisher.FluxPeek$PeekSubscriber.onComplete(FluxPeek.java:260)
      at reactor.core.publisher.Operators$MultiSubscriptionSubscriber.onComplete(Operators.java:2058)
      at reactor.core.publisher.MonoIgnoreThen$ThenIgnoreMain.onComplete(MonoIgnoreThen.java:209)
      at reactor.core.publisher.MonoIgnoreThen$ThenIgnoreMain.onComplete(MonoIgnoreThen.java:209)
      at reactor.pool.SimpleDequePool.lambda$maybeRecycleAndDrain$19(SimpleDequePool.java:554)
      at reactor.core.publisher.LambdaMonoSubscriber.onComplete(LambdaMonoSubscriber.java:135)
      at reactor.core.publisher.FluxDoFinally$DoFinallySubscriber.onComplete(FluxDoFinally.java:145)
      at reactor.core.publisher.Operators.complete(Operators.java:137)
      at reactor.core.publisher.MonoEmpty.subscribe(MonoEmpty.java:46)
      at reactor.core.publisher.MonoDefer.subscribe(MonoDefer.java:52)
      at reactor.core.publisher.Mono.subscribe(Mono.java:4400)
      at reactor.core.publisher.Mono.subscribeWith(Mono.java:4515)
      at reactor.core.publisher.Mono.subscribe(Mono.java:4371)
      at reactor.core.publisher.Mono.subscribe(Mono.java:4307)
      at reactor.pool.SimpleDequePool.maybeRecycleAndDrain(SimpleDequePool.java:548)
      at reactor.pool.SimpleDequePool$QueuePoolRecyclerInner.onComplete(SimpleDequePool.java:765)
      at reactor.core.publisher.Operators.complete(Operators.java:137)
      at reactor.core.publisher.MonoEmpty.subscribe(MonoEmpty.java:46)
      at reactor.core.publisher.Mono.subscribe(Mono.java:4400)
      at reactor.pool.SimpleDequePool$QueuePoolRecyclerMono.subscribe(SimpleDequePool.java:877)
      at reactor.core.publisher.MonoDefer.subscribe(MonoDefer.java:52)
      at reactor.core.publisher.MonoIgnoreThen$ThenIgnoreMain.subscribeNext(MonoIgnoreThen.java:240)
      at reactor.core.publisher.MonoIgnoreThen$ThenIgnoreMain.onComplete(MonoIgnoreThen.java:203)
      at reactor.core.publisher.FluxPeek$PeekSubscriber.onComplete(FluxPeek.java:260)
      at reactor.core.publisher.Operators.complete(Operators.java:137)
      at reactor.core.publisher.MonoEmpty.subscribe(MonoEmpty.java:46)
      at reactor.core.publisher.Mono.subscribe(Mono.java:4400)
      at reactor.core.publisher.MonoIgnoreThen$ThenIgnoreMain.subscribeNext(MonoIgnoreThen.java:263)
      at reactor.core.publisher.MonoIgnoreThen.subscribe(MonoIgnoreThen.java:51)
      at reactor.core.publisher.MonoDefer.subscribe(MonoDefer.java:52)
      at reactor.core.publisher.MonoIgnoreThen$ThenIgnoreMain.subscribeNext(MonoIgnoreThen.java:240)
      at reactor.core.publisher.MonoIgnoreThen$ThenIgnoreMain.onComplete(MonoIgnoreThen.java:203)
      at reactor.core.publisher.MonoIgnoreElements$IgnoreElementsSubscriber.onComplete(MonoIgnoreElements.java:89)
      at reactor.core.publisher.FluxHandle$HandleSubscriber.onComplete(FluxHandle.java:220)
      at reactor.core.publisher.FluxSwitchIfEmpty$SwitchIfEmptySubscriber.onComplete(FluxSwitchIfEmpty.java:85)
      at reactor.core.publisher.Operators$MonoSubscriber.complete(Operators.java:1817)
      at reactor.core.publisher.MonoCallable.subscribe(MonoCallable.java:62)
      at reactor.core.publisher.Mono.subscribe(Mono.java:4400)
      at reactor.core.publisher.MonoIgnoreThen$ThenIgnoreMain.subscribeNext(MonoIgnoreThen.java:263)
      at reactor.core.publisher.MonoIgnoreThen.subscribe(MonoIgnoreThen.java:51)
      at reactor.core.publisher.InternalMonoOperator.subscribe(InternalMonoOperator.java:64)
      at reactor.core.publisher.MonoDefer.subscribe(MonoDefer.java:52)
      at reactor.core.publisher.Mono.subscribe(Mono.java:4400)
      at reactor.core.publisher.FluxOnErrorResume$ResumeSubscriber.onError(FluxOnErrorResume.java:103)
      at reactor.core.publisher.MonoIgnoreElements$IgnoreElementsSubscriber.onError(MonoIgnoreElements.java:84)
      at reactor.core.publisher.FluxMap$MapSubscriber.onError(FluxMap.java:134)
      at reactor.core.publisher.FluxFilter$FilterSubscriber.onError(FluxFilter.java:157)
      at reactor.core.publisher.FluxFilter$FilterConditionalSubscriber.onError(FluxFilter.java:291)
      at reactor.core.publisher.FluxMap$MapConditionalSubscriber.onError(FluxMap.java:265)
      at reactor.core.publisher.Operators.error(Operators.java:198)
      at reactor.core.publisher.MonoError.subscribe(MonoError.java:53)
      at reactor.core.publisher.MonoDeferContextual.subscribe(MonoDeferContextual.java:55)
      at reactor.core.publisher.InternalMonoOperator.subscribe(InternalMonoOperator.java:64)
      at reactor.core.publisher.MonoDefer.subscribe(MonoDefer.java:52)
      at reactor.core.publisher.Mono.subscribe(Mono.java:4400)
      at reactor.core.publisher.FluxUsingWhen$UsingWhenSubscriber.onError(FluxUsingWhen.java:364)
      at reactor.core.publisher.MonoStreamCollector$StreamCollectorSubscriber.onError(MonoStreamCollector.java:150)
      at reactor.core.publisher.FluxFlatMap$FlatMapMain.checkTerminated(FluxFlatMap.java:842)
      at reactor.core.publisher.FluxFlatMap$FlatMapMain.drainLoop(FluxFlatMap.java:608)
      at reactor.core.publisher.FluxFlatMap$FlatMapMain.drain(FluxFlatMap.java:588)
      at reactor.core.publisher.FluxFlatMap$FlatMapMain.onError(FluxFlatMap.java:451)
      at reactor.core.publisher.FluxOnAssembly$OnAssemblySubscriber.onError(FluxOnAssembly.java:544)
      at reactor.core.publisher.FluxMap$MapSubscriber.onError(FluxMap.java:134)
      at reactor.core.publisher.FluxFlatMap$FlatMapMain.checkTerminated(FluxFlatMap.java:842)
      at reactor.core.publisher.FluxFlatMap$FlatMapMain.drainLoop(FluxFlatMap.java:608)
      at reactor.core.publisher.FluxFlatMap$FlatMapMain.drain(FluxFlatMap.java:588)
      at reactor.core.publisher.FluxFlatMap$FlatMapMain.innerError(FluxFlatMap.java:863)
      at reactor.core.publisher.FluxFlatMap$FlatMapInner.onError(FluxFlatMap.java:990)
      at reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.onError(FluxMapFuseable.java:142)
      at reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.onNext(FluxMapFuseable.java:121)
      at reactor.core.publisher.FluxIterable$IterableSubscription.slowPath(FluxIterable.java:272)
      at reactor.core.publisher.FluxIterable$IterableSubscription.request(FluxIterable.java:230)
      at reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.request(FluxMapFuseable.java:171)
      at reactor.core.publisher.FluxFlatMap$FlatMapInner.onSubscribe(FluxFlatMap.java:964)
      at reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.onSubscribe(FluxMapFuseable.java:96)
      at reactor.core.publisher.FluxIterable.subscribe(FluxIterable.java:165)
      at reactor.core.publisher.FluxIterable.subscribe(FluxIterable.java:87)
      at reactor.core.publisher.Flux.subscribe(Flux.java:8469)
      at reactor.core.publisher.FluxFlatMap$FlatMapMain.onNext(FluxFlatMap.java:426)
      at reactor.core.publisher.FluxArray$ArraySubscription.slowPath(FluxArray.java:127)
      at reactor.core.publisher.FluxArray$ArraySubscription.request(FluxArray.java:100)
      at reactor.core.publisher.FluxFlatMap$FlatMapMain.onSubscribe(FluxFlatMap.java:371)
      at reactor.core.publisher.FluxArray.subscribe(FluxArray.java:53)
      at reactor.core.publisher.FluxArray.subscribe(FluxArray.java:59)
      at reactor.core.publisher.MonoFromFluxOperator.subscribe(MonoFromFluxOperator.java:81)
      at reactor.core.publisher.MonoUsingWhen$ResourceSubscriber.onNext(MonoUsingWhen.java:183)
      at reactor.core.publisher.FluxMap$MapSubscriber.onNext(FluxMap.java:122)
      at reactor.core.publisher.FluxOnErrorResume$ResumeSubscriber.onNext(FluxOnErrorResume.java:79)
      at reactor.core.publisher.FluxOnErrorResume$ResumeSubscriber.onNext(FluxOnErrorResume.java:79)
      at reactor.core.publisher.FluxRetry$RetrySubscriber.onNext(FluxRetry.java:87)
      at reactor.core.publisher.Operators$MonoSubscriber.complete(Operators.java:1816)
      at reactor.core.publisher.MonoFlatMap$FlatMapInner.onNext(MonoFlatMap.java:249)
      at io.r2dbc.pool.MonoDiscardOnCancel$MonoDiscardOnCancelSubscriber.onNext(MonoDiscardOnCancel.java:92)
      at reactor.core.publisher.FluxOnErrorResume$ResumeSubscriber.onNext(FluxOnErrorResume.java:79)
      at reactor.core.publisher.MonoIgnoreThen$ThenIgnoreMain.complete(MonoIgnoreThen.java:292)
      at reactor.core.publisher.MonoIgnoreThen$ThenIgnoreMain.onNext(MonoIgnoreThen.java:187)
      at reactor.core.publisher.MonoIgnoreThen$ThenIgnoreMain.subscribeNext(MonoIgnoreThen.java:236)
      at reactor.core.publisher.MonoIgnoreThen$ThenIgnoreMain.onComplete(MonoIgnoreThen.java:203)
      at reactor.core.publisher.MonoIgnoreElements$IgnoreElementsSubscriber.onComplete(MonoIgnoreElements.java:89)
      at reactor.core.publisher.FluxHandle$HandleSubscriber.onComplete(FluxHandle.java:220)
      at reactor.core.publisher.FluxSwitchIfEmpty$SwitchIfEmptySubscriber.onComplete(FluxSwitchIfEmpty.java:85)
      at reactor.core.publisher.Operators$MonoSubscriber.complete(Operators.java:1817)
      at reactor.core.publisher.MonoCallable.subscribe(MonoCallable.java:62)
      at reactor.core.publisher.Mono.subscribe(Mono.java:4400)
      at reactor.core.publisher.MonoIgnoreThen$ThenIgnoreMain.subscribeNext(MonoIgnoreThen.java:263)
      at reactor.core.publisher.MonoIgnoreThen.subscribe(MonoIgnoreThen.java:51)
      at reactor.core.publisher.InternalMonoOperator.subscribe(InternalMonoOperator.java:64)
      at io.r2dbc.pool.MonoDiscardOnCancel.subscribe(MonoDiscardOnCancel.java:50)
      at reactor.core.publisher.MonoFlatMap$FlatMapMain.onNext(MonoFlatMap.java:157)
      at reactor.pool.AbstractPool$Borrower.deliver(AbstractPool.java:469)
      at reactor.pool.SimpleDequePool.lambda$drainLoop$9(SimpleDequePool.java:423)
      at reactor.core.publisher.FluxDoOnEach$DoOnEachSubscriber.onNext(FluxDoOnEach.java:154)
      at reactor.core.publisher.FluxMapFuseable$MapFuseableConditionalSubscriber.onNext(FluxMapFuseable.java:299)
      at reactor.core.publisher.Operators$MonoSubscriber.complete(Operators.java:1816)
      at reactor.core.publisher.MonoSupplier.subscribe(MonoSupplier.java:62)
      at reactor.core.publisher.Mono.subscribe(Mono.java:4400)
      at reactor.core.publisher.FluxConcatArray$ConcatArraySubscriber.onComplete(FluxConcatArray.java:258)
      at reactor.core.publisher.FluxConcatArray.subscribe(FluxConcatArray.java:78)
      at reactor.core.publisher.Flux.subscribe(Flux.java:8469)
      at reactor.core.publisher.Flux.subscribeWith(Flux.java:8642)
      at reactor.core.publisher.Flux.subscribe(Flux.java:8439)
      at reactor.core.publisher.Flux.subscribe(Flux.java:8363)
      at reactor.pool.SimpleDequePool.drainLoop(SimpleDequePool.java:453)
      at reactor.pool.SimpleDequePool.pendingOffer(SimpleDequePool.java:600)
      at reactor.pool.SimpleDequePool.doAcquire(SimpleDequePool.java:296)
      at reactor.pool.AbstractPool$Borrower.request(AbstractPool.java:432)
      at reactor.core.publisher.MonoFlatMap$FlatMapMain.onSubscribe(MonoFlatMap.java:110)
      at reactor.pool.SimpleDequePool$QueueBorrowerMono.subscribe(SimpleDequePool.java:720)
      at reactor.core.publisher.InternalMonoOperator.subscribe(InternalMonoOperator.java:64)
      at reactor.core.publisher.MonoDefer.subscribe(MonoDefer.java:52)
      at reactor.core.publisher.FluxRetry$RetrySubscriber.resubscribe(FluxRetry.java:117)
      at reactor.core.publisher.MonoRetry.subscribeOrReturn(MonoRetry.java:50)
      at reactor.core.publisher.Mono.subscribe(Mono.java:4385)
      at reactor.core.publisher.FluxOnErrorResume$ResumeSubscriber.onError(FluxOnErrorResume.java:103)
      at reactor.core.publisher.MonoFlatMap$FlatMapMain.onError(MonoFlatMap.java:172)
      at reactor.core.publisher.FluxMap$MapSubscriber.onError(FluxMap.java:134)
      at reactor.core.publisher.Operators.error(Operators.java:198)
      at reactor.core.publisher.MonoError.subscribe(MonoError.java:53)
      at reactor.core.publisher.MonoDeferContextual.subscribe(MonoDeferContextual.java:55)
      at reactor.core.publisher.Mono.subscribe(Mono.java:4400)
      at reactor.core.publisher.MonoUsingWhen.subscribe(MonoUsingWhen.java:96)
      at reactor.core.publisher.Mono.subscribe(Mono.java:4400)
      at reactor.test.DefaultStepVerifierBuilder$DefaultStepVerifier.toVerifierAndSubscribe(DefaultStepVerifierBuilder.java:867)
      at reactor.test.DefaultStepVerifierBuilder$DefaultStepVerifier.verify(DefaultStepVerifierBuilder.java:823)
      at reactor.test.DefaultStepVerifierBuilder$DefaultStepVerifier.verify(DefaultStepVerifierBuilder.java:815)
      at reactor.test.DefaultStepVerifierBuilder.verifyComplete(DefaultStepVerifierBuilder.java:682)
      at com.example.r2dbctransaction.R2dbcTransactionApplicationTests.initDB(R2dbcTransactionApplicationTests.java:60)
      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:725)
      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.interceptLifecycleMethod(TimeoutExtension.java:126)
      at org.junit.jupiter.engine.extension.TimeoutExtension.interceptBeforeAllMethod(TimeoutExtension.java:68)
      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.ClassBasedTestDescriptor.lambda$invokeBeforeAllMethods$11(ClassBasedTestDescriptor.java:397)
      at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
      at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.invokeBeforeAllMethods(ClassBasedTestDescriptor.java:395)
      at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.before(ClassBasedTestDescriptor.java:209)
      at org.junit.jupiter.engine.descriptor.ClassBasedTestDescriptor.before(ClassBasedTestDescriptor.java:80)
      at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:148)
      at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
      at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
      at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
      at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
      at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
      at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
      at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
      at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
      at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41)
      at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155)
      at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
      at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
      at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
      at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
      at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
      at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
      at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
      at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:35)
      at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57)
      at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:54)
      at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:107)
      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:114)
      at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:95)
      at org.junit.platform.launcher.core.DefaultLauncherSession$DelegatingLauncher.execute(DefaultLauncherSession.java:91)
      at org.junit.platform.launcher.core.SessionPerRequestLauncher.execute(SessionPerRequestLauncher.java:60)
      at org.eclipse.jdt.internal.junit5.runner.JUnit5TestReference.run(JUnit5TestReference.java:98)
      at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:40)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:529)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:756)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:452)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:210)
      Suppressed: org.springframework.r2dbc.BadSqlGrammarException: execute; bad SQL grammar [create table account (
      id INT auto_increment,
      user_name VARCHAR(50),
      balance INT
  );
  </code></pre>
  <p>Test Case:</p>
  <pre><code>package com.example.r2dbctransaction;
  
  import java.io.IOException;
  import java.nio.charset.StandardCharsets;
  
  import org.junit.jupiter.api.BeforeAll;
  import org.junit.jupiter.api.MethodOrderer;
  import org.junit.jupiter.api.Test;
  import org.junit.jupiter.api.TestInstance;
  import org.junit.jupiter.api.TestMethodOrder;
  import org.springframework.beans.factory.annotation.Autowired;
  import org.springframework.beans.factory.annotation.Value;
  import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest;
  import org.springframework.boot.test.context.SpringBootTest;
  import org.springframework.core.annotation.Order;
  import org.springframework.core.io.Resource;
  import org.springframework.data.r2dbc.core.R2dbcEntityTemplate;
  import org.springframework.test.context.ActiveProfiles;
  import org.springframework.test.context.TestPropertySource;
  import org.springframework.test.context.junit4.SpringRunner;
  import org.springframework.util.StreamUtils;
  
  import com.example.r2dbctransaction.entity.Account;
  import com.example.r2dbctransaction.repository.AccountRepository;
  import com.example.r2dbctransaction.request.DepositRequest;
  import com.example.r2dbctransaction.service.BankService;
  
  import reactor.core.publisher.Mono;
  import reactor.test.StepVerifier;
  
  
  @ActiveProfiles(&quot;test&quot;)
  @TestPropertySource(locations=&quot;classpath:application-test.properties&quot;)
  @SpringBootTest
  @TestMethodOrder(MethodOrderer.OrderAnnotation.class)
  @TestInstance(TestInstance.Lifecycle.PER_CLASS)
  class R2dbcTransactionApplicationTests {
  
      @Value(&quot;classpath:init.sql&quot;)
      private Resource initSql;
  
      @Autowired
      private R2dbcEntityTemplate entityTemplate;
  
      @Autowired
      private BankService bankService;
  
      @Autowired
      private AccountRepository repository;
  
      @BeforeAll
      public void initDB() throws IOException {
          String query = StreamUtils.copyToString(initSql.getInputStream(), StandardCharsets.UTF_8);
          Mono&lt;Void&gt; mono = this.entityTemplate
                  .getDatabaseClient()
                  .sql(query)
                  .then();
  
          StepVerifier.create(mono)
                  .verifyComplete();
      }
  
      @Test
      @Order(1)
      void transactionSuccess() {
          DepositRequest request = DepositRequest.create(1, 500);
          Mono&lt;Account&gt; mono = this.bankService.deposit(request)
                  .then(getAccountDetails(request));
          StepVerifier.create(mono)
                  .expectNextMatches(ac -&gt; ac.getBalance() == 500)
                  .verifyComplete();
      }
  
      @Test
      @Order(2)
      void transactionFailure() {
          DepositRequest request = DepositRequest.create(1, 99);
          Mono&lt;Account&gt; mono = this.bankService.deposit(request)
                  .onErrorResume(ex -&gt; Mono.empty())
                  .then(getAccountDetails(request));
          StepVerifier.create(mono)
                  .expectNextMatches(ac -&gt; ac.getBalance() == 500)
                  .verifyComplete();
      }
  
      private Mono&lt;Account&gt; getAccountDetails(DepositRequest request){
          return this.repository.findById(request.getAccount())
                      .doOnNext(System.out::println);
      }
  
  }
  </code></pre>