June 2018
Beginner
722 pages
18h 47m
English
Let's create a unit test that proves the method works as expected. By now, you should be able to create a UtilsTest class in the test/java/com/packt/javapath/ch06demo directory (or in the test\java\com\packt\javapath\ch06demo directory in the case of the Windows). The test should look like this:
@DisplayName("Utils tests")public class UtilsTest { @Test @DisplayName("Test reading value from config file by key") void getStringValueFromConfig(){ //test body we will write here }}
Next, we add the test/resources/utilstest.conf file (test\resources\utilstest.conf for Windows):
{ "unknown": "some value"}
It will play the role of a config file. With that, the test code looks as follows:
@Test@DisplayName("Test reading value from config ...
Read now
Unlock full access