vmtest/src/main/java/org/apidesign/bck2brwsr/vmtest/impl/Bck2BrwsrCase.java
branchemul
changeset 626 f08eb4df84c1
parent 623 4af0d3dedb9d
child 641 d4aaa46cac0d
     1.1 --- a/vmtest/src/main/java/org/apidesign/bck2brwsr/vmtest/impl/Bck2BrwsrCase.java	Thu Jan 31 17:39:47 2013 +0100
     1.2 +++ b/vmtest/src/main/java/org/apidesign/bck2brwsr/vmtest/impl/Bck2BrwsrCase.java	Thu Jan 31 19:21:37 2013 +0100
     1.3 @@ -17,9 +17,11 @@
     1.4   */
     1.5  package org.apidesign.bck2brwsr.vmtest.impl;
     1.6  
     1.7 +import java.io.ByteArrayInputStream;
     1.8  import java.io.File;
     1.9  import java.io.FileWriter;
    1.10  import java.io.IOException;
    1.11 +import java.io.InputStream;
    1.12  import java.lang.reflect.Constructor;
    1.13  import java.lang.reflect.InvocationTargetException;
    1.14  import java.lang.reflect.Method;
    1.15 @@ -60,7 +62,13 @@
    1.16                  c.setHtmlFragment(html.value());
    1.17              }
    1.18              if (http != null) {
    1.19 -                c.setHttpResource(http.path(), http.mimeType(), http.content());
    1.20 +                if (!http.content().isEmpty()) {
    1.21 +                    InputStream is = new ByteArrayInputStream(http.content().getBytes("UTF-8"));
    1.22 +                    c.setHttpResource(http.path(), http.mimeType(), is);
    1.23 +                } else {
    1.24 +                    InputStream is = m.getDeclaringClass().getResourceAsStream(http.resource());
    1.25 +                    c.setHttpResource(http.path(), http.mimeType(), is);
    1.26 +                }
    1.27              }
    1.28              String res = c.invoke();
    1.29              value = res;