MCPcopy Create free account
hub / github.com/GateNLP/gate-core / testGetResources

Method testGetResources

src/test/java/gate/util/TestFiles.java:39–66  ·  view source on GitHub ↗

Test the getResourceAs... methods.

()

Source from the content-addressed store, hash-verified

37
38 /** Test the getResourceAs... methods. */
39 public void testGetResources() throws Exception {
40 assertTrue(true);
41 String japeResName = "gate.ac.uk/tests/ft-bt-03-aug-2001.html";
42 String firstLine = "<!-- Vignette V/5 Mon Aug 06 07:50:01 2001 -->";
43
44 BufferedReader bufResReader =
45 new BomStrippingInputStreamReader(Files.getGateResourceAsStream(japeResName));
46 assertTrue(bufResReader.readLine().equals(firstLine));
47 bufResReader.close();
48
49 String resString = Files.getGateResourceAsString(japeResName);
50 assertTrue(resString.startsWith(firstLine));
51
52 byte[] resBytes = Files.getGateResourceAsByteArray(japeResName);
53
54 /*
55 Out.println(new String(resBytes));
56 Out.println(resBytes.length);
57 Out.println(resString);
58 Out.println(resString.length());
59 */
60
61 char resChars[] = new char[firstLine.length()];
62 for(int i=0; i<resChars.length; i++) resChars[i] = (char)resBytes[i];
63 resString = new String(resChars);
64 assertTrue(resString, resString.equals(firstLine));
65
66 } // testGetResources()
67
68 /** Test the writeTempFile... method. */
69 public void testWriteTempFile() throws Exception {

Callers

nothing calls this directly

Calls 7

readLineMethod · 0.95
closeMethod · 0.95
equalsMethod · 0.65
lengthMethod · 0.45

Tested by

no test coverage detected