Step 1. Structure of tests and syntax for test in JS
Create the file for the tests
- Java: Make sure to include "Test" in the end of the filename
Create a named test with a function (JS) method (Java)
Step 2. introduce "matchers" or "assertions"
- Java: For a list of assertions, refer to JUnit Examples
Step 3. Create a test to verify if a vehicle is affordable.
- Create a test to verify if a sentence ends with a period.
Create a new Java test class.
Declare a list of String with Swedish greetings.
Create some tests to verify:
- If the list contains common Swedish greetings
- If the list does not contain English greeting
- If the list does not contain goodbye greeting
This time, code a function that should verify if a sentence ends with a period. Then test it!