Getting illegalargument error in tiingoservicetest

im using this function in my tiingoservice file

:-
public List getStockQuote(String symbol, LocalDate from, LocalDate to) throws JsonProcessingException {
////////
}

but im still getting illegal argument exception :-
com.crio.warmup.stock.quotes.TiingoServiceTest > getStockQuoteSingle() FAILED
java.lang.IllegalArgumentException at TiingoServiceTest.java:64
Caused by: java.net.URISyntaxException at TiingoServiceTest.java:64

can somebody explain it to me why am i getting this error?

Can you try throwing URIException because you are also using uri which can cause some exceptions and you have not thrown it explicitly. Let me know if this reply was helpful or not.

You could try opening the test file to see how the function is being called there and try to change your code to match that.

previous error was resolved . thanx

im using resttemplateobject.getForObject(URI,String.class) but still
im getting an assertion error at all the urlcaptor, urlcaptorwithmap, urlcaptorasuri.
I looked about it and i found that it checks the argument passed to the desired variable or class.
In this case i guess it is checking for resttemplate as we are mocking resttemplate at the start of the test.
Im using String.class as an argument for getForObject which in many cases is a reason behind this error but still im getting this error.
Any hints would be appreciated

i did change that but couldn’t get rid of the error

i have converted the string to the uri and passed it as .getforobject(uri,String.class)

still it shows error what should i do?

I think the above FAQ can give you insight about the error you are facing. Please let me know if the above FAQ was helpful or not.

no that was not helpful
String path = “https://api.tiingo.com/tiingo/daily/” + symbol + “/prices?” + “startDate=” + from + “&endDate=” + to
+ “&token=ebbeeaf988704487eb28a613cbacc02deaf66687”;
URI palu = new URI(path);
RestTemplate restTemplate = new RestTemplate();
String s = restTemplate.getForObject(palu, String.class);

im using this in my tiingoservice file
but still im getting error on these lines intiingoservicetest file
assertTrue(!propertyKeyValues3.isEmpty());

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

Hi @Pallav_crio,

Try removing RestTemplate restTemplate = new RestTemplate(); and instead use the RestTemplate supplied by initialising a local RestTemplate instance through a constructor.

The assertion is checking if you are using the passed restTemplate or not. Your code isn’t using it. That’s why its failing.

I just saw your code, that test case is passing now.

Closing this topic as your issue is resolved by the mentor. If it is still not resolved, please feel free to create a new topic and post this question as a reference link in the description of the new topic.