Skip to content

Commit bbc2be9

Browse files
add test
1 parent 6389402 commit bbc2be9

2 files changed

Lines changed: 51 additions & 0 deletions

File tree

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
2+
package latte;
3+
import java.io.BufferedReader;
4+
import java.io.InputStream;
5+
import java.io.InputStreamReader;
6+
import java.util.ArrayList;
7+
8+
import specification.Borrowed;
9+
import specification.Free;
10+
import specification.Shared;
11+
import specification.Unique;
12+
13+
import java.io.UnsupportedEncodingException;
14+
15+
public class HttpEntityNoAnnotations {
16+
17+
public static void test(HttpResponse r) throws UnsupportedEncodingException {
18+
HttpResponse response = r;
19+
InputStream in = response.getEntity().getContent();
20+
BufferedReader reader = new BufferedReader(
21+
new InputStreamReader(
22+
response.getEntity().getContent(), "UTF-8")); // Second call to getEntity()
23+
24+
//Cannot call getContent twice if the entity is not repeatable. There is a method isRepeatable() to check
25+
}
26+
}
27+
28+
class HttpResponse {
29+
// TODO: STUB METHOD
30+
public HttpEntity getEntity() {
31+
return new HttpEntity();
32+
}
33+
}
34+
35+
class HttpEntity {
36+
// TODO: STUB METHOD
37+
public InputStream getContent() {
38+
return (InputStream) new Object();
39+
}
40+
}

latte-umbrella/src/test/java/latte/latte_umbrella/AppTest.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,17 @@ public void testBox1(){
7979

8080
}
8181

82+
83+
@Test
84+
public void testHttpEntityNoAnnotations(){
85+
try {
86+
App.launcher("src/test/examples/HttpEntityNoAnnotations.java");
87+
} catch (Exception e) {
88+
e.printStackTrace();
89+
assert(false);
90+
}
91+
}
92+
8293
/*
8394
* Incorrect Examples
8495
*/

0 commit comments

Comments
 (0)