source: java2python/jackson-t/src/test/java/tudelft/utilities/j2p/EndNegoTest.java@ 1271

Last change on this file since 1271 was 1238, checked in by wouter, 9 days ago

doc

File size: 1.7 KB
Line 
1package tudelft.utilities.j2p;
2
3import java.io.File;
4import java.io.IOException;
5import java.nio.file.Paths;
6import java.util.Arrays;
7
8import org.junit.Test;
9
10import tudelft.utilities.j2p.t.TranslationException;
11import tudelft.utilities.logging.Reporter;
12import tudelft.utilities.logging.SavingReporter;
13import tudelft.utilities.pyrunner.PythonError;
14import tudelft.utilities.pyrunner.PythonVenv;
15
16/**
17 * The EndNegotiation.java file is not compiling as intended because Caused by:
18 * tudelft.utilities.j2p.t.TranslationException: parameter 'id' must equal the
19 * property name but found 'actor' at @JsonProperty("actor") PartyId id (line
20 * 13,col 24)-(line 13,col 56) *
21 */
22public class EndNegoTest {
23
24 @Test
25 public void test()
26 throws IOException, ClassNotFoundException, TranslationException {
27 PyProgram program = PyProgram.fromDirectories(
28 Arrays.asList((Paths.get("src/test/endnego"))));
29 System.out.println(program);
30 }
31
32 // expecting error: constructor id should be "actor".
33 @Test(expected = TranslationException.class)
34 public void test2()
35 throws IOException, ClassNotFoundException, TranslationException {
36 PyProgram program = PyProgram.fromDirectories(
37 Arrays.asList((Paths.get("src/test/endnego2"))));
38 System.out.println(program);
39 }
40
41 @Test
42 public void test3() throws IOException, ClassNotFoundException,
43 TranslationException, InterruptedException, PythonError {
44 PyProgram program = PyProgram.fromDirectories(
45 Arrays.asList((Paths.get("src/test/endnego3"))));
46 System.out.println(program);
47
48 Reporter reporter = new SavingReporter("test");
49 File zipfile = program.getZip();
50 PythonVenv venv = new PythonVenv(zipfile, reporter);
51 String res = venv.call(Arrays.asList("-m", "testcode.EndNegotiation3"),
52 10000);
53
54 }
55}
Note: See TracBrowser for help on using the repository browser.