@Test public void tryLock() { assertThat(temp.getRoot().list()).isEmpty(); lock.tryLock(); assertThat(temp.getRoot().toPath().resolve(".sonar_lock")).exists(); lock.unlock(); }
@Test public void errorTryLock() { lock = new DirectoryLock(Paths.get("non", "existing", "path"), mock(Logger.class)); exception.expect(IllegalStateException.class); exception.expectMessage("Failed to create lock"); lock.tryLock(); }