Faling Tiingo service tests

I Implemented Tiingo class Successfully but TiingoServicetest.java case is fails because of this line because it’s size remain zero. how to solved it

test case fails because it want true and it will true if they are non-empty .
can any one tell me how do i solve this

@yogiraj.218m0064 Please refer to the following FAQ

And anyhow it is Ok to fail few tests initially without completing the overall implementation but after implementing all the TODO’s / milestones , the .gradlew build should pass.

Actully blow test are got equals so i think Tiingo Api Works Fine

assertEquals(candles.get(0).getOpen(), 1027.2, 0.3);

so i think it will not give me NullPointer exception it give me test case fail
the expected as true we get False in the below image

So actually i do not understand what “urlCaptor.getAllValues();” and below lines do actually with the help of " Mockito.verify(restTemplate, atLeast(0)) " in TiingoServicetest.java file??

@yogiraj.218m0064

Firstly make sure you have all the TODO’s in all the files.

Please refer to this threads


This line basically means that Mockito is asked to verify if the getForObject() method of RestTemplate object is called with the parameters urlCaptorAsUri.capture() and any(Class.class). The parameter in the atLeast() method tells Mockito to verify that the said method is called at least x times, 0 means n number of times.

Reference: https://stackoverflow.com/questions/27787487/java-verify-void-method-calls-n-times-with-mockito

This code is used to capture the first argument when the method getForObject() of RestTemplate object is called.

Reference: https://www.javadoc.io/doc/org.mockito/mockito-core/2.6.9/org/mockito/ArgumentCaptor.html


So from all the information provided, I think you are getting an assertion error in this code below.

assertTrue(!propertyKeyValues.isEmpty() || !propertyKeyValues2.isEmpty() || !propertyKeyValues3
        .isEmpty());

This assertion is checking that all of the 3 captured arguments have value and none of them is null, true in the former case and false in the latter. But your error stack trace is showing false and that means one of the parameters is null. You need to carefully debug as to why this is happening as mentioned by @sashi_Crio.Do sir refer the threads, there is a high chance that someone has faced a similar problem.

Another note, give this article a read, will definitely help you.
Link: https://codeahoy.com/2016/04/30/do-experienced-programmers-use-google-frequently/

Closing this topic as there is no response since last 12 hours. Please feel free to create a new topic and post this question as a reference link in the description of the new topic.