我正在使用HAPI V2库运行一个非常简单的测试 .
@Test
public void testHapiContext()
{
HapiContext context = new DefaultHapiContext();
try
{
context.close();
assertTrue(true);
}
catch (IOException e)
{
fail("Close threw an exception");
}
}
此JUnit测试始终失败,因为close()方法抛出NullPointer异常 . 知道为什么吗?
另一方面,我可以做我想用HAPI上下文做的一切,除了调用close()但不调用close会导致Eclipse给我一个泄漏警告 .