Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • main - here are our source codes, with working functionalities 

    Code Block
    public class SourceCodeClass {
         
     
        public static void main(String[] args) {
            System.out.printf("This is our main class!");
        }
     
    }


  • test - here are test classes, that check whether source code is working properly. This is where our JUnit5 is used → TestClass.java 


    A test method is a method that fulfills these three requirements:

    • A test method isn't private or static
    • A test method must not return anything. In other words, its return type must be void.
    • A test method must be annotated with the @Test annotation.
    Code Block
    // We import jupiter to our class to use proper annotation
    import org.junit.jupiter.api.*;
    
    // This is optional annotation that is sedused to increase readability 
    @DisplayName("JUnit 5 Example class")
    class TestClass {
    
         // This is obligatory annotation on test methods
        @Test
        void exampleTest() {
            System.out.println("example test method");
        }
    
    }


...