### Question:
NativeLibraryManager implements NativeLibraryExtractor { public void extractFile(final String operatingSystem, final String architecture, final String fileName) throws IOException { final String pathToNativeFile = buildPathToNativeFile(operatingSystem, architecture, fileName); if (!store.containsItem(pathToNativeFile)) { InputStream inputStream = null; OutputStream outputStream = null; try { inputStream = metaClass.getResourceAsStream(pathToNativeFile); outputStream = store.getItemOutputStream(pathToNativeFile); IOUtils.copy(inputStream, outputStream); } finally { IOUtils.closeQuietly(inputStream); IOUtils.closeQuietly(outputStream); } } } NativeLibraryManager(final PersistenceStore store); void extractFiles(); void extractFile(final String operatingSystem, final String architecture, final String fileName); static synchronized void initialize();  }### Answer:
@Test public void extractFile() throws IOException { final ByteArrayOutputStream baos = new ByteArrayOutputStream(); final PersistenceStore store = mock(PersistenceStore.class); when(store.containsItem(isA(String.class))).thenReturn(false); when(store.getItemOutputStream(isA(String.class))).thenReturn(baos); final NativeLibraryManager manager = new NativeLibraryManager(store); manager.extractFile("win32", "x86", "native_auth.dll"); Assert.assertEquals(67240, baos.size()); }
@Test public void extractFile_noArch() throws IOException { final ByteArrayOutputStream baos = new ByteArrayOutputStream(); final PersistenceStore store = mock(PersistenceStore.class); when(store.containsItem(isA(String.class))).thenReturn(false); when(store.getItemOutputStream(isA(String.class))).thenReturn(baos); final NativeLibraryManager manager = new NativeLibraryManager(store); manager.extractFile("macosx", null, "libnative_auth.jnilib"); Assert.assertEquals(118960, baos.size()); }