We've tested our strategies many times using the Solution class's
testStrategy() method. It's time to use JUnit to write real unit tests.
14.1. Read about unit tests.
14.2. Download and connect the JUnit 4.12 library. Figure out how to use it.
The JUnit library depends on the hamcrest-core library.
Shortener (14)
- 32
Locked
Comments (3)
- Popular
- New
- Old
You must be signed in to leave a comment
Justin Smith
1 February, 16:35
The instructions for this task are really insufficient, so here are a few clarifications:
1. The tests package must go in the root for the project, not in the strategy package.
2. All methods in the FunctionalTest class must be public. I had initially assumed that testStorage would be private since it is only called from within the class, but no, it must be public or the validation will act as though you have not even created the method at all.
3. When it says to add @Test to all of the test methods, it should have said "except for the testStorage method".
I'm fairly certain there's a #4 in the above list. I still haven't passed this task, even though I have reviewed the solution and found that my code is nearly identical (except for superfluous differences that wouldn't matter, unless this is one of those times where CG is looking for a very specific thing without saying it).
At this point I've given this enough time, I'm going to move on to the next part of the course.
0
MaGaby2280
7 July 2021, 19:17
https://mvnrepository.com/artifact/org.hamcrest/hamcrest-core/2.2
0
MaGaby2280
7 July 2021, 19:15
https://mvnrepository.com/artifact/junit/junit/4.13.2
0