diff --git a/README.md b/README.md index 259e112..8a1b1e3 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,6 @@ -# goj judger api for java +# goj judger api for java + +[![Build Status](https://travis-ci.org/gojudge/gojapi-java.svg)](https://travis-ci.org/gojudge/gojapi-java) here is the goj judger api for java developer. diff --git a/src/test/java/net/duguying/goj/JudgerHTTPTest.java b/src/test/java/net/duguying/goj/JudgerHTTPTest.java index 73a754e..deac61d 100644 --- a/src/test/java/net/duguying/goj/JudgerHTTPTest.java +++ b/src/test/java/net/duguying/goj/JudgerHTTPTest.java @@ -2,6 +2,8 @@ import junit.framework.TestCase; +import java.util.Map; + /** * Created by rex on 2015/1/26. */ @@ -13,5 +15,13 @@ protected void setUp() { public void testJudgerHTTP(){ this.h = new JudgerHTTP("oj.duguying.net", 1005, "123456789"); + + Map response = this.h.AddTask(12,"randomstring","C","int main(){return 0;}"); + boolean rst = (Boolean)response.get("result"); + assertTrue(rst); + + Map response2 = this.h.GetStatus(12, "randomstring"); + int rst2 = (Integer)response2.get("id"); + assertEquals(12, rst2); } } diff --git a/src/test/java/net/duguying/goj/JudgerTCPTest.java b/src/test/java/net/duguying/goj/JudgerTCPTest.java index 6d9da9c..7c63b5f 100644 --- a/src/test/java/net/duguying/goj/JudgerTCPTest.java +++ b/src/test/java/net/duguying/goj/JudgerTCPTest.java @@ -2,6 +2,7 @@ import junit.framework.TestCase; import java.io.IOException; +import java.util.Map; public class JudgerTCPTest extends TestCase { private JudgerTCP j = null; @@ -16,6 +17,28 @@ public void testJudgerTCP() { // assert connect success assertNotNull(this.j); + Map response = null; + try { + response = this.j.AddTask(12,"randomstring","C","int main(){return 0;}"); + } catch (IOException e) { + e.printStackTrace(); + } + boolean rst = (Boolean)response.get("result"); + + // assert add task + assertTrue(rst); + + Map response2 = null; + try { + response2 = this.j.GetStatus(12,"randomstring"); + } catch (IOException e) { + e.printStackTrace(); + } + int rst2 = (Integer)response2.get("id"); + + // assert get status + assertEquals(12, rst2); + this.j = null; System.gc(); }