How to pass this test case

How to pass ExtrapolatedAnnualizedReturnWithException() test case :thinking:

You need to throw StackQuoteServiceException.

@gouravsardana Do you mean StockQuoteServiceException??

Yeah. You need to throw this !

I am throwing it already

Let me check your workspace once.

I just check your code. You are throwing an exception and catching it. If you catch an exception just wrap up with StockQuoteServiceException and re-throw it

3 Likes

But i am not catching StockQuoteService Exception

Thanks @gouravsardana sir for helping.

I am also facing the same issue but i have wrapped the exception with StockQuoteServiceException but its still failing the same case

It might be the case you are catching it again

in my code while mapping for candles is performed i am using catch for jsonProcessingException so i wrapped it StockService expception however it didnt pass the case so i did the same for the future object at the time when i was adding the future object to the final list to be returned by wrapping exectionException with stockServiceException

1 Like

Should i rather include the whole code in the method in try block and in the catch block for an object e of Exception class wrap it up with stockQuoteServiceException

Before pushing the code i wrote this comment

After pushing this worked and i passed my test cases

Should i remove this post or let it stay ?

1 Like

I am unable to pass this test case. I tried the above mentioned methods, but it still failed. Can someone help please with some detailed hints?

@gouravsardana sir could you please check my workspace once and give me a review what went wrong.

But during adding the future object to final list, stockserviceException is not being accepted by compiler.

Exactly, i faced the same issue too.

@Kunal
Thanks. It worked. Wrap the exception of future object with StockQuoteServieceException.

1 Like

I am also facing the same issue I tried handling the StockQuoteServieceException while calling get function on future object but still can’t pass this test case.

I got this solved by replacing the printStackTrace with throwing StockQuoteException @Kunal really helped. thanks

1 Like