Example #1
0
  @Test
  public void testCopy() throws Exception {
    String data = "rar";
    ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
    InputStream inputStream = new ByteArrayInputStream(data.getBytes());

    TypeHandlerUtils.copy(inputStream, outputStream);

    Assert.assertEquals(data, new String(outputStream.toByteArray()));
  }
  @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));
  }