View Javadoc
1   /*
2    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
3    * The software in this package is published under the terms of the CPAL v1.0
4    * license, a copy of which has been included with this distribution in the
5    * LICENSE.txt file.
6    */
7   package org.mule.transformer.simple;
8   
9   import org.mule.util.IOUtils;
10  
11  import java.io.ByteArrayInputStream;
12  import java.io.InputStream;
13  
14  public class ObjectByteArrayTransformersWithResultStreamTestCase extends
15      ObjectByteArrayTransformersWithObjectsTestCase
16  {
17  
18      @Override
19      public Object getResultData()
20      {
21          byte[] resultData = (byte[])super.getResultData();
22          return new ByteArrayInputStream(resultData);
23      }
24  
25      @Override
26      public boolean compareResults(Object expected, Object result)
27      {
28          if (expected instanceof InputStream)
29          {
30              InputStream input = (InputStream)expected;
31              byte[] bytes = IOUtils.toByteArray(input);
32              return super.compareResults(bytes, result);
33          }
34          return super.compareResults(expected, result);
35      }
36  
37  }