Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fixed ReusedSessionFileStore when file store does not exists

  • Loading branch information...
commit 025962d3fa5062bb8a532fe91451278974408af8 1 parent c0a8b69
@lfryc lfryc authored
View
5 .../org/jboss/arquillian/drone/webdriver/factory/remote/reusable/ReusedSessionFileStore.java
@@ -35,6 +35,11 @@
public ReusedSessionStore loadStoreFromFile(File file) {
try {
byte[] readStore = readStore(file);
+
+ if (readStore == null) {
+ return null;
+ }
+
ReusedSessionStore loadedSession = SerializationUtils.deserializeFromBytes(ReusedSessionStore.class, readStore);
return loadedSession;
} catch (InvalidClassException e) {
View
14 ...lian/drone/webdriver/factory/remote/reusable/TestReusedSessionStoreImplSerialization.java
@@ -18,6 +18,7 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
import java.io.File;
import java.io.IOException;
@@ -64,4 +65,17 @@ public void when_store_is_serialized_to_file_then_it_can_be_deserialized_and_reu
}
}
}
+
+ @Test
+ public void when_store_file_does_not_exists_then_null_is_returned() {
+
+ // given
+ File nonExistent = new File("this-file-really-does-not-exists");
+
+ // when
+ ReusedSessionStore loadedStore = fileStore.loadStoreFromFile(nonExistent);
+
+ // then
+ assertNull(loadedStore);
+ }
}
Please sign in to comment.
Something went wrong with that request. Please try again.