示例#1
0
  private void testReadSqlXml(boolean close) throws Exception {
    byte[] result = null;
    String data = "tar.gz";

    // when(sqlXml.getBinaryStream()).thenReturn(new ByteArrayInputStream(data.getBytes()));
    when(MappingUtils.invokeFunction(sqlXml, "getBinaryStream", new Class[] {}, new Object[] {}))
        .thenReturn(new ByteArrayInputStream(data.getBytes()));

    if (close == true) {
      result = TypeHandlerUtils.readSqlXml(sqlXml);
    } else {
      result = TypeHandlerUtils.readSqlXml(sqlXml, false);
    }

    Assert.assertEquals(data, new String(result));
  }