Working with JUnit

satya - 8/11/2020, 4:43:27 PM

Junit home

Junit home

satya - 8/11/2020, 5:01:03 PM

JUnit 5 seem too complicated

JUnit 5 seem too complicated

Search for: JUnit 5 seem too complicated

satya - 8/11/2020, 5:01:18 PM

So I go with junit4 for now

So I go with junit4 for now

satya - 8/11/2020, 5:01:55 PM

Download: The 2 jar files for Juni4

Download: The 2 jar files for Juni4

satya - 8/11/2020, 9:32:29 PM

You can do this once you have that at a module level


package com.ai.aspire.config;

import org.junit.Test;
import com.ai.application.utils.AppObjects;

public class ModuleTest 
{
   @Test
   public void mainTest()
   throws Exception
   {
      //setup
      AppObjects.initApplicationFromEnvPropertiesFile();
      
      //actual tests
      ObjectDefinition.test();
   }
   private void test1()
   {
      p("Hello");
   }
   
   private void p(String s)
   {
      System.out.println(s);
   }
}

satya - 8/11/2020, 9:33:35 PM

An inane way perhaps...

1. One of these for each package

2. Each class will have static methods

3. Module test will call them once for each class

4. A class may call inside many number of other tests

satya - 8/11/2020, 9:33:55 PM

This will allow me to run the class using the run icon of eclipse as a Junit

This will allow me to run the class using the run icon of eclipse as a Junit

satya - 8/11/2020, 9:34:15 PM

There is likely a better way to do this. will do for now

There is likely a better way to do this. will do for now

satya - 8/11/2020, 9:34:20 PM

When I now I will post

When I now I will post