Changeset 2 for simplerunner


Ignore:
Timestamp:
08/28/19 11:35:52 (5 years ago)
Author:
bart
Message:

Added new parties : linear, hardliner, conceder, boulware

Location:
simplerunner/src/test
Files:
2 added
1 edited

Legend:

Unmodified
Added
Removed
  • simplerunner/src/test/java/geniusweb/simplerunner/SessionRunnerE2ETest.java

    r1 r2  
    55import java.nio.file.Files;
    66import java.nio.file.Paths;
     7import java.util.Arrays;
     8import java.util.Collection;
    79
    810import org.junit.Before;
    911import org.junit.Test;
     12import org.junit.runner.RunWith;
     13import org.junit.runners.Parameterized;
     14import org.junit.runners.Parameterized.Parameters;
    1015
    1116import com.fasterxml.jackson.databind.ObjectMapper;
    1217
    1318import geniusweb.protocol.session.SessionSettings;
    14 import geniusweb.simplerunner.ClassPathConnectionFactory;
    15 import geniusweb.simplerunner.NegoRunner;
    1619import tudelft.utilities.logging.ReportToLogger;
    1720import tudelft.utilities.logging.Reporter;
     
    2225 * this module.
    2326 */
     27@RunWith(Parameterized.class)
    2428public class SessionRunnerE2ETest {
    25         private static final String SESSION_SETTINGS = "src/test/resources/settings.json";
    2629        private final ObjectMapper jackson = new ObjectMapper();
    2730        private NegoRunner runner;
    2831        private Reporter logger = new ReportToLogger("test");
     32        private String filename;
     33
     34        @Parameters
     35        public static Collection<Object[]> data() {
     36                return Arrays.asList(
     37                                new Object[][] { { "src/test/resources/settings.json" }, { "src/test/resources/settings2.json" } });
     38        }
     39
     40        public SessionRunnerE2ETest(String file) {
     41                this.filename = file;
     42        }
    2943
    3044        @Before
    3145        public void before() throws IOException {
    32                 String serialized = new String(
    33                                 Files.readAllBytes(Paths.get(SESSION_SETTINGS)),
    34                                 StandardCharsets.UTF_8);
    35                 SessionSettings settings = jackson.readValue(serialized,
    36                                 SessionSettings.class);
     46                String serialized = new String(Files.readAllBytes(Paths.get(filename)), StandardCharsets.UTF_8);
     47                SessionSettings settings = jackson.readValue(serialized, SessionSettings.class);
    3748
    38                 runner = new NegoRunner(settings, new ClassPathConnectionFactory(),
    39                                 logger);
     49                runner = new NegoRunner(settings, new ClassPathConnectionFactory(), logger);
    4050
    4151        }
     
    5262        @Test
    5363        public void runTestMainFunction() throws IOException {
    54                 NegoRunner.main(new String[] { SESSION_SETTINGS });
     64                NegoRunner.main(new String[] { filename });
    5565        }
    5666}
Note: See TracChangeset for help on using the changeset viewer.