<p>I am writing unit tests for a class, which has a static final variable.
However, since the state of the static final var is modified in each test, I need some way to reinitialize it.</p>

<p>
How would this be possible? Would i need to use some sort of a custom classloader? </p>

<p>
The variable is initialized as - 
<pre>
 static final CountdownLatch latch = new CountdownLatch(1);
</pre>

</p>

One (not very efficient) approach assuming you are using junit and ant.
You could create a separate class for each test method, and then use a forkmode of
```
perTest
```
.
As the
Ant junit task documentation
states:
Controls how many Java Virtual Machines get created if you want to fork some tests. Possible values are "perTest" (the default), "perBatch" and "once". "once" creates only a single Java VM for all tests while "perTest" creates a new VM for each TestCase class. "perBatch" creates a VM for each nested <batchtest> and one collecting all nested <test>s. Note that only tests with the same settings of filtertrace, haltonerror, haltonfailure, errorproperty and failureproperty can share a VM, so even if you set forkmode to "once", Ant may have to create more than a single Java VM. This attribute is ignored for tests that don't get forked into a new Java VM. since Ant 1.6.2