forked from I2P_Developers/i2p.i2p
ConvertToHashMockTest: Clean up after using TestContext
This commit is contained in:
@@ -4,6 +4,7 @@ import net.i2p.TestContext;
|
||||
import net.i2p.client.naming.NamingService;
|
||||
import net.i2p.data.Destination;
|
||||
import net.i2p.data.Hash;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.Before;
|
||||
|
||||
import org.junit.Test;
|
||||
@@ -27,6 +28,16 @@ public class ConvertToHashMockTest{
|
||||
MockitoAnnotations.initMocks(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset the global context after all tests in the class are done.
|
||||
*
|
||||
* We would otherwise pollute the other tests that depend on I2PAppContext
|
||||
*/
|
||||
@AfterClass
|
||||
public static void afterClass(){
|
||||
TestContext.setGlobalContext(null);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMockedDestination() {
|
||||
when(namingService.lookup("zzz.i2p")).thenReturn(destination);
|
||||
|
||||
Reference in New Issue
Block a user