author | Jaroslav Tulach <jaroslav.tulach@apidesign.org> |
Thu, 10 Jan 2013 20:15:11 +0100 | |
changeset 424 | aef4fd91e99c |
child 425 | af1d8e828955 |
permissions | -rw-r--r-- |
jaroslav@424 | 1 |
/* |
jaroslav@424 | 2 |
* To change this template, choose Tools | Templates |
jaroslav@424 | 3 |
* and open the template in the editor. |
jaroslav@424 | 4 |
*/ |
jaroslav@424 | 5 |
package org.apidesign.bck2brwsr.tck; |
jaroslav@424 | 6 |
|
jaroslav@424 | 7 |
import java.io.InputStream; |
jaroslav@424 | 8 |
import org.apidesign.bck2brwsr.vmtest.Compare; |
jaroslav@424 | 9 |
import org.apidesign.bck2brwsr.vmtest.VMTest; |
jaroslav@424 | 10 |
import org.testng.annotations.Factory; |
jaroslav@424 | 11 |
|
jaroslav@424 | 12 |
/** |
jaroslav@424 | 13 |
* |
jaroslav@424 | 14 |
* @author Jaroslav Tulach <jtulach@netbeans.org> |
jaroslav@424 | 15 |
*/ |
jaroslav@424 | 16 |
public class ResourcesTest { |
jaroslav@424 | 17 |
|
jaroslav@424 | 18 |
@Compare public String readResourceAsStream() throws Exception { |
jaroslav@424 | 19 |
InputStream is = getClass().getResourceAsStream("Resources.txt"); |
jaroslav@424 | 20 |
byte[] b = new byte[30]; |
jaroslav@424 | 21 |
int len = is.read(b); |
jaroslav@424 | 22 |
StringBuilder sb = new StringBuilder(); |
jaroslav@424 | 23 |
for (int i = 0; i < len; i++) { |
jaroslav@424 | 24 |
sb.append((char)b[i]); |
jaroslav@424 | 25 |
} |
jaroslav@424 | 26 |
return sb.toString(); |
jaroslav@424 | 27 |
} |
jaroslav@424 | 28 |
|
jaroslav@424 | 29 |
@Factory public static Object[] create() { |
jaroslav@424 | 30 |
return VMTest.create(ResourcesTest.class); |
jaroslav@424 | 31 |
} |
jaroslav@424 | 32 |
} |