Skip to Main Content

Java Database Connectivity (JDBC)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

java.lang.AssertionError in unit test (integration)

Luis Rodriguez FernandezApr 12 2019 — edited Jun 3 2019

Hello there,

My setup:

  • java version "1.8.0_191" --> Java HotSpot(TM) 64-Bit Server VM (build 25.191-b12, mixed mode)
  • Apache Maven 3.6.0
  • spring-boot-2.1.4.RELEASE
  • ojdbc8 12.2.0.1.0 (latest one freshly downloaded from oracle.com )

My integration test looks like below one, no rocket science here.

Running it with $mvn integration-test -DskipUTs -Doracle.net.tns_admin=/my/tnsfolder I get

java.lang.AssertionError: Server is sending a non-null replay context but our replayModes=[]

Adding some diagnosis options to the jdbc driver did not help very much

mvn integration-test -DskipUTs -Doracle.net.tns_admin=/home/lurodrig/development/etc -Doracle.jdbc.Trace=true -Djava.util.logging.config.file=/tmp/OracleLog.properties

Any thoughts on this?

Thanks in advance,

Luis

ps: -DskipUTs is a nice trick from https://antoniogoncalves.org/2012/12/13/lets-turn-integration-tests-with-maven-to-a-first-class-citizen/ thanks Antonio!

package hello;

import hello.Model;

import hello.services.Service;

import java.util.ArrayList;

import java.util.List;

import static org.assertj.core.api.Assertions.assertThat;

import org.junit.Test;

import org.springframework.beans.factory.annotation.Autowired;

import org.junit.runner.RunWith;

import org.springframework.boot.test.context.SpringBootTest;

import org.springframework.test.context.junit4.SpringRunner;

@RunWith(SpringRunner.class)

@SpringBootTest()

public class HelloIT {

        @Autowired

        private Service myService;

           

    @Test

    public void myTest() {

            List<Model> list = myMockedList();

            assertThat(myService.findAll()).isEqualTo(list);

    }  

}

Comments
Post Details
Added on Apr 12 2019
1 comment
1,535 views