Example #1
0
 @Test
 public void shouldNotLoadDiskDumpWhenUsingARepoThatIsAlreadyCreated()
     throws ClassNotFoundException, IOException {
   SubsetSizeRepo fooRepo = factory.createSubsetRepo("foo", LATEST_VERSION);
   File file = new File(baseDir, EntryRepoFactory.name("foo", LATEST_VERSION, SUBSET_SIZE));
   ObjectOutputStream outStream = new ObjectOutputStream(new FileOutputStream(file));
   outStream.writeObject(
       new ArrayList<SubsetSizeEntry>(
           Arrays.asList(new SubsetSizeEntry(1), new SubsetSizeEntry(2), new SubsetSizeEntry(3))));
   outStream.close();
   assertThat(fooRepo.list().size(), is(0));
   assertThat(factory.createSubsetRepo("foo", LATEST_VERSION).list().size(), is(0));
 }
  @Test
  public void shouldBeAbleToSerialiseAndDeserialise() throws IOException, ClassNotFoundException {
    ByteArrayOutputStream bytes = new ByteArrayOutputStream();
    ObjectOutputStream output = new ObjectOutputStream(bytes);

    output.writeObject(config);
    output.flush();
    output.close();

    ObjectInputStream input = new ObjectInputStream(new ByteArrayInputStream(bytes.toByteArray()));
    final ChromeDriverConfig deserializedConfig = (ChromeDriverConfig) input.readObject();

    assertThat(deserializedConfig, is(config));
  }