source: events/src/test/java/geniusweb/actions/EndNegoTest.java@ 52

Last change on this file since 52 was 52, checked in by ruud, 14 months ago

Fixed small issues in domaineditor.

File size: 1.5 KB
Line 
1package geniusweb.actions;
2
3import static org.junit.Assert.assertEquals;
4
5import java.io.IOException;
6import java.util.Arrays;
7import java.util.List;
8
9import org.junit.Test;
10
11import com.fasterxml.jackson.core.JsonProcessingException;
12import com.fasterxml.jackson.databind.ObjectMapper;
13
14import tudelft.utilities.junit.GeneralTests;
15
16public class EndNegoTest extends GeneralTests<EndNegotiation> {
17 private final ObjectMapper jackson = new ObjectMapper();
18
19 private final PartyId id = new PartyId("party1");
20 private final PartyId idb = new PartyId("party2");
21
22 private final EndNegotiation endnego = new EndNegotiation(id);
23 private final EndNegotiation endnego1 = new EndNegotiation(id);
24 private final EndNegotiation endnegob = new EndNegotiation(idb);
25
26 private final String endnegostring = "{\"EndNegotiation\":{\"actor\":\"party1\"}}";
27
28 @Override
29 public List<List<EndNegotiation>> getGeneralTestData() {
30 return Arrays.asList(Arrays.asList(endnego, endnego1),
31 Arrays.asList(endnegob));
32 }
33
34 @Override
35 public List<String> getGeneralTestStrings() {
36 return Arrays.asList("EndNegotiation\\[.*" + id + ".*\\]",
37 "EndNegotiation\\[.*" + idb + ".*\\]");
38 }
39
40 @Test
41 public void serializeEndNegoTest() throws JsonProcessingException {
42 System.out.println(jackson.writeValueAsString(endnego));
43 assertEquals(endnegostring, jackson.writeValueAsString(endnego));
44 }
45
46 @Test
47 public void deserializeEndNegoTest() throws IOException {
48 Action act = jackson.readValue(endnegostring, Action.class);
49 assertEquals(endnego, act);
50 }
51
52}
Note: See TracBrowser for help on using the repository browser.