コード例 #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()));
  }
コード例 #2
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));
  }