### Question:
OpsLoggerFactory { public OpsLoggerFactory setStackTraceStoragePath(Path directory) { validateParametersForSetStackTraceStoragePath(directory); clearCachedInstance(); setStoreStackTracesInFilesystem(true); stackTraceStoragePath = Optional.of(directory); return this; }  OpsLoggerFactory setDestination(PrintStream printStream); OpsLoggerFactory setPath(Path path); OpsLoggerFactory setStoreStackTracesInFilesystem(boolean store); OpsLoggerFactory setStackTraceStoragePath(Path directory); OpsLoggerFactory setErrorHandler(Consumer<Throwable> handler); @Deprecated OpsLoggerFactory setCorrelationIdSupplier(Supplier<Map<String,String>> supplier); OpsLoggerFactory setGlobalDiagnosticContextSupplier(DiagnosticContextSupplier supplier); OpsLoggerFactory setAsync(boolean async); @SuppressWarnings("unchecked") OpsLogger<T> build();  }### Answer:
@Test public void setStackTraceStoragePath_shouldNotThrowAnException_givenAPathThatExistsAndIsADirectory() throws Exception { Path directory = tempFiles.createTempDirectory(); factory.setStackTraceStoragePath(directory); }
@Test public void setStackTraceStoragePath_shouldNotCreateAnyDirectories_whenBuildIsNotCalled() throws Exception { Path parent = tempFiles.createTempDirectoryThatDoesNotExist(); Path child = tempFiles.register(parent.resolve("child")); assertFalse(Files.exists(parent)); assertFalse(Files.exists(child)); factory.setStackTraceStoragePath(child); assertFalse(Files.exists(parent)); assertFalse(Files.exists(child)); }
@Test public void setStackTraceStoragePath_shouldThrowAnException_givenNull() throws Exception { try { factory.setStackTraceStoragePath(null); fail("Expected an exception"); } catch (NullPointerException expected) { assertThat(expected.getMessage(), containsString("must not be null")); } }
@Test public void setStackTraceStoragePath_shouldThrowAnException_givenAPathThatExistsAndIsNotADirectory() throws Exception { Path file = tempFiles.createTempFile(".txt"); try { factory.setStackTraceStoragePath(file); fail("expected an exception"); } catch (IllegalArgumentException expected) { assertThat(expected.getMessage(), containsString("must be a directory")); } }