package tudelft.utilities.j2p; import java.io.File; import java.io.IOException; import java.nio.file.Paths; import java.util.Arrays; import org.junit.Test; import tudelft.utilities.j2p.t.TranslationException; import tudelft.utilities.logging.Reporter; import tudelft.utilities.logging.SavingReporter; import tudelft.utilities.pyrunner.PythonError; import tudelft.utilities.pyrunner.PythonVenv; /** * The EndNegotiation.java file is not compiling as intended because Caused by: * tudelft.utilities.j2p.t.TranslationException: parameter 'id' must equal the * property name but found 'actor' at @JsonProperty("actor") PartyId id (line * 13,col 24)-(line 13,col 56) * */ public class EndNegoTest { @Test public void test() throws IOException, ClassNotFoundException, TranslationException { PyProgram program = PyProgram.fromDirectories( Arrays.asList((Paths.get("src/test/endnego")))); System.out.println(program); } // expecting error: constructor id should be "actor". @Test(expected = TranslationException.class) public void test2() throws IOException, ClassNotFoundException, TranslationException { PyProgram program = PyProgram.fromDirectories( Arrays.asList((Paths.get("src/test/endnego2")))); System.out.println(program); } @Test public void test3() throws IOException, ClassNotFoundException, TranslationException, InterruptedException, PythonError { PyProgram program = PyProgram.fromDirectories( Arrays.asList((Paths.get("src/test/endnego3")))); System.out.println(program); Reporter reporter = new SavingReporter("test"); File zipfile = program.getZip(); PythonVenv venv = new PythonVenv(zipfile, reporter); String res = venv.call(Arrays.asList("-m", "testcode.EndNegotiation3"), 10000); } }