File tree Expand file tree Collapse file tree 1 file changed +16
-3
lines changed
src/test/java/org/scijava/thread Expand file tree Collapse file tree 1 file changed +16
-3
lines changed Original file line number Diff line number Diff line change 3333
3434import static org .junit .Assert .assertSame ;
3535
36+ import org .junit .After ;
37+ import org .junit .Before ;
3638import org .junit .Test ;
3739import org .scijava .Context ;
3840
4345 */
4446public class ThreadServiceTest {
4547
48+ private Context context ;
49+ private ThreadService threadService ;
50+
51+ @ Before
52+ public void setUp () {
53+ context = new Context (ThreadService .class );
54+ threadService = context .getService (ThreadService .class );
55+ }
56+
57+ @ After
58+ public void tearDown () {
59+ context .dispose ();
60+ }
61+
4662 /**
4763 * Tests {@link ThreadService#getParent(Thread)} when called after
4864 * {@link ThreadService#invoke(Runnable)}.
4965 */
5066 @ Test
5167 public void testGetParent () throws Exception {
52- final Context context = new Context (ThreadService .class );
53- final ThreadService threadService = context .getService (ThreadService .class );
5468 final AskForParent ask = new AskForParent (threadService );
5569 threadService .invoke (ask );
5670 assertSame (Thread .currentThread (), ask .parent );
57- context .dispose ();
5871 }
5972
6073 private static class AskForParent implements Runnable {
You can’t perform that action at this time.
0 commit comments