Assignment Failed Module 3

Passed all test in Gradle build but failed 1 test in Assignment Tests:-

mainCalculateReturnsOldTrades()

And also I am not able to see the content of ModuleThreeTest.java :thinking:

Any hints?

This is a hidden test case. It checks for older trade dates (possibly 2017, 2018 or before that).
Make sure you are calculating number of years properly.
And also check if you are passing correct BuyPrice and SellPrice.
open of StartDate is your BuyPrice. close of EndDate is your SellPrice.

Hint: Use ChronoUnit to calculate numbers of days between two dates and then convert that value into years. (totalYears=totalNumberOfDays/365). Make sure to use Double for everything.

If everything is calculated properly, you might have made a small logical mistake somewhere. Use debugger to find it.

Also refer this: Test invalid stock is failing, tried every possibility

1 Like

Thank you so much @ElancE

I have one more question:-

Why content of ModuleThreeTest.java is not visible?

I am not sure why it’s empty.
You might get some idea from this: My module3test.java is empty

1 Like