public ReflectionUtilsInstaller(ReflectionUtils instance) { _oldInstance = ReflectionUtils.setInstance(instance); _curInstance = instance; }
@Override public void close() throws Exception { if (ReflectionUtils.setInstance(_oldInstance) != _curInstance) { throw new IllegalStateException( "Instances of this resource must be closed in reverse order of opening."); } } }
when(confBlob.fetchUnzipToTemp(any())).thenReturn(300L); ReflectionUtils origRU = ReflectionUtils.setInstance(mockedRU); ServerUtils origUtils = ServerUtils.setInstance(mockedU); try { } finally { bl.close(); ReflectionUtils.setInstance(origRU); ServerUtils.setInstance(origUtils);