-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Simple JUnit test and runner used to create the test.yaml GHA workflow
- Loading branch information
Showing
2 changed files
with
53 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package edu.ucar.metviewer.test.mvutil; | ||
|
||
import edu.ucar.metviewer.MVUtil; | ||
import org.junit.Test; | ||
|
||
import org.junit.runner.notification.Failure; | ||
import org.w3c.dom.Document; | ||
|
||
|
||
|
||
import static org.junit.Assert.*; | ||
|
||
|
||
public class TestMVUtil { | ||
@Test | ||
public void testCreateDocument(){ | ||
try{ | ||
System.out.println("Testing CreateDocument..."); | ||
assertTrue(MVUtil.createDocument() instanceof Document ); | ||
assertTrue(MVUtil.createDocument() != null); | ||
|
||
}catch (javax.xml.parsers.ParserConfigurationException e){ | ||
fail("ParserConfigurationException was raised while creating a document"); | ||
} | ||
} | ||
|
||
|
||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package edu.ucar.metviewer.test.mvutil; | ||
|
||
import com.sun.net.httpserver.Authenticator; | ||
import org.junit.runner.JUnitCore; | ||
import org.junit.runner.Result; | ||
import org.junit.runner.notification.Failure; | ||
|
||
|
||
// Useful for running from the command line | ||
|
||
|
||
public class TestRunner { | ||
public static void main(String[] args){ | ||
Result result = JUnitCore.runClasses(TestMVUtil.class); | ||
|
||
for (Failure failure : result.getFailures()){ | ||
System.out.println(failure.toString()); | ||
} | ||
|
||
System.out.println("Tests pass: "+ result.wasSuccessful() + "\nNumber of runs: " + | ||
result.getRunCount()); | ||
} | ||
} |