Skip to content
Permalink
Browse files

minor JU4 updates

  • Loading branch information...
bobjacobsen committed Sep 9, 2018
1 parent d9393ef commit c02b773dc88c0d787bddcda1e4938464d8539026
Showing with 15 additions and 4 deletions.
  1. +15 −4 help/en/html/doc/Technical/JUnit.shtml
@@ -672,15 +672,16 @@
<p>
You then reference "folder" in your test code:
<pre style="font-family: monospace;">
// create a file in "temp"
File rosterDir = folder.newFolder();
File backupDir = folder.newFolder();
// create a temporary file
File randomNameFile = folder.newFile();
// create a temporary directory
File randomNameDir = folder.newFolder();
</pre>


JUnit4 will make sure the file or folder is removed afterwards regardless of whether the
test succeeds or fails. For more information on this, see the
<a href="http://junit.org/junit4/javadoc/latest/org/junit/rules/TemporaryFolder.html">Javadoc for TemporaryFolderTest</a>.
<a href="http://junit.org/junit4/javadoc/latest/org/junit/rules/TemporaryFolder.html">Javadoc for TemporaryFolder</a>.

<p>
If you're not using JUnit4, consider converting the
@@ -1172,6 +1173,16 @@ import org.junit.Test;
</pre>
</li>

<li>If you have bare <code>assert</code> calls, like
<pre style="font-family: monospace;">
assertEquals(k, ind);
</pre>
change them to the JUnit4 form:
<pre style="font-family: monospace;">
Assert.assertEquals(k, ind);
</pre>
</li>

<li>More of our Test classes have a "from here down is
testing infrastructure" comment, followed by setup code.
Some of that can be removed. First, remove the class

0 comments on commit c02b773

Please sign in to comment.
You can’t perform that action at this time.