@Test(expected = IOException.class)
public void shouldThrowExceptionWhenUnableToCreateSessionDirectory() throws IOException {

    assumeFalse(OsUtils.isWindows());
    String nonWritableDirectory = FileUtils.createTempDirectory();
    new File(nonWritableDirectory).setWritable(false);
    FileSessionStorage storage = new FileSessionStorage(nonWritableDirectory);
    HttpSessionImpl sessionWrapper = new HttpSessionImpl(VALID_SESSION_ID, System.currentTimeMillis());
    sessionWrapper.setAttribute("attributeName", "SomeValue");
    storage.persistSession(sessionWrapper);
}