This is a very basic question for JUnit testing. I wrote a program which calculate the new position of a dot by given instructions for moving. The program is working properly but I have to write a JUnit test for check the result and I don’t know how.
Share
Write a test method for every dot movement that you want to check. In each test method you call your method and then compare the actual result with the expected result.
Try something like this, using JUnit 4.x :