Examples for Unittests

Do you have better documentation on unit tests ?

I created a *Test.java file in src/main/test and when I run mvn test i get the following error:


T E S T S

org.apache.maven.surefire.util.SurefireReflectionException: java.lang.reflect.InvocationTargetException; nested exception is java.lang.reflect.InvocationTargetException: null
java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)
Caused by: java.lang.NullPointerException
at totalcross.ui.font.Font.fontCreate(Font.java:217)
at totalcross.ui.font.Font.(Font.java:101)
at totalcross.ui.font.Font.getFont(Font.java:156)
at totalcross.ui.font.Font.getFont(Font.java:147)
at totalcross.ui.Control.(Control.java:386)
at totalcross.ui.Container.(Container.java:143)
at totalcross.ui.Window.(Window.java:300)
at totalcross.ui.Window.(Window.java:330)
at totalcross.ui.MainWindow.(MainWindow.java:96)
at totalcross.ui.MainWindow.(MainWindow.java:83)
at test_ui.add_numbers_ui.(add_numbers_ui.java:24)
at test_ui.TestAdd.(TestAdd.java:7)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
at java.base/java.lang.Class.newInstance(Class.java:584)
at org.apache.maven.surefire.junit.PojoTestSet.(PojoTestSet.java:63)
at org.apache.maven.surefire.junit.JUnit3Provider.createTestSet(JUnit3Provider.java:107)
at org.apache.maven.surefire.junit.JUnit3Provider.invoke(JUnit3Provider.java:97)
… 9 more

Results :

Tests run: 0, Failures: 0, Errors: 0, Skipped: 0