0

I have a spring boot application, which is connecting to two different data sources. (All the connection, URL, other DB properties are different and configure in application.properties file)

I am not able to test this application because mockito or any other testing framework wouldn't be able to distinguish between two different data sources.

Please suggest how to test this application.

pri
  • 1,521
  • 2
  • 13
  • 26
  • Wouldn't you be mocking the DB calls? Or are you talking about integration testing? – pri Jan 18 '18 at 14:18
  • integration testing and while try to mock datasources it will not able to distinguish between datasources ; because it only understand the dependency by type. – vivek gupta Jan 18 '18 at 14:24
  • Are you using an in-memory database to mock the calls? Or are you using when().thenReturn() pattern to mock your DB calls? – pri Jan 18 '18 at 14:27
  • nope its external DB and using when().thenReturn() way... – vivek gupta Jan 18 '18 at 14:29
  • 1
    If it's when().thenReturn() way, then why do you need to differentiate between the 2 data sources? – pri Jan 18 '18 at 14:32
  • Because I am connecting to two different data sources in my application,So the name are different.Spring injecting them based on Name but Mockito can't.. – vivek gupta Jan 19 '18 at 06:14

0 Answers0