AlphavantageServiceTest Assertion Error

The following assertion error seems to occur, when testing my class
Though the stock quotes are getting fetched and filtered out properly, something’s not right?
Help is appreciated :slight_smile:

List<String> propertyKeyValues = urlCaptor.getAllValues();
List<String> propertyKeyValues2 = urlCaptorWithMap.getAllValues();
List<URI> propertyKeyValues3 = urlCaptorAsUri.getAllValues();
assertTrue(!propertyKeyValues.isEmpty() || !propertyKeyValues2.isEmpty() || !propertyKeyValues3

@anand-crio Please Have a look

Wasn’t the discussion on this thread helpful? Look for the posts from @shoryajain , probably. We talked about this issue later in this thread .

1 Like

Sir I believe this is the thread you are talking about.

@jyotirmoy-paul I had the same issue I believe.

I am making sure to use getForObject and also buliding the Uri in the AlphavantageClass, but still something’s not adding up

also, @anand-crio Please confirm me, that for the constructor in AlphavantageClass we don’t need to pass the restTemplate, right? coz by default it was not there? Could that be an issue?

Did you try testing after passing restTemplate? Because I think that’s the reason here.

Doing that is causing another exception, lemme give it a try

No I had checked it, the API call is working fine, moreover the test related to checking the value of API Call is not causing an issue

When I’m passing restTemplate through the constructor for the AlphavantageClass, the jsonResponse is null, whereas while I’m instantiating restTemplate in the class itself, there’s causing an assertion error.
Please confirm me, if restTemplate is required to be passed for the AlphavantageClass or not, accordingly I will find a fix to the issue

if there is an assertion error , goto the assertoion in the testcase and try to figure out what it is checking for, and how to overcome that error.

Ya, I found the error :slight_smile: thanks

1 Like

I am facing the same error? Any hints?