Index: events/src/test/java/geniusweb/actions/VoteWithValueTest.java
===================================================================
--- events/src/test/java/geniusweb/actions/VoteWithValueTest.java	(revision 30)
+++ events/src/test/java/geniusweb/actions/VoteWithValueTest.java	(revision 30)
@@ -0,0 +1,99 @@
+package geniusweb.actions;
+
+import static org.junit.Assert.assertEquals;
+
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+import geniusweb.issuevalue.Bid;
+import geniusweb.issuevalue.DiscreteValue;
+import geniusweb.issuevalue.NumberValue;
+import geniusweb.issuevalue.Value;
+import tudelft.utilities.junit.GeneralTests;
+
+public class VoteWithValueTest extends GeneralTests<VoteWithValue> {
+	private final ObjectMapper jackson = new ObjectMapper();
+
+	private static final PartyId id = new PartyId("party1");
+	private static final PartyId id2 = new PartyId("party2");
+	private final static Map<String, Value> issuevalues = new HashMap<String, Value>();
+	private final static Map<String, Value> issuevaluesb = new HashMap<String, Value>();
+	private static Bid bid;
+	private static Bid bidb;
+	private final static String ISSUE1 = "issue1";
+	private final static Value VALUE1 = new DiscreteValue("value1");
+	private final static String ISSUE2 = "issue2";
+	private final static Value VALUE2 = new NumberValue("10");
+	// issue 2 is NUMBER and thus serializes with leading '='
+	private final String votestring = "{\"votewithvalue\":{\"actor\":\"party1\",\"bid\":{\"issuevalues\":{\"issue2\":10,\"issue1\":\"value1\"}},\"minPower\":1,\"maxPower\":2,\"value\":10}}";
+
+	private static VoteWithValue vote1, vote1a, vote2, vote3, vote4, vote5,
+			vote6;
+
+	static {
+		issuevalues.put(ISSUE1, VALUE1);
+		issuevalues.put(ISSUE2, VALUE2);
+		bid = new Bid(issuevalues);
+		vote1 = new VoteWithValue(id, bid, 1, 2, 10);
+		vote1a = new VoteWithValue(id, bid, 1, 2, 10);
+
+		vote2 = new VoteWithValue(id2, bid, 1, 2, 10);
+
+		// values swapped, so different issuevalues.
+		issuevaluesb.put(ISSUE1, VALUE2);
+		issuevaluesb.put(ISSUE2, VALUE2);
+		bidb = new Bid(issuevaluesb);
+		vote3 = new VoteWithValue(id, bidb, 1, 2, 10);
+
+		vote4 = new VoteWithValue(id, bid, 2, 2, 10);
+		vote5 = new VoteWithValue(id, bid, 1, 3, 10);
+
+		vote6 = new VoteWithValue(id, bid, 1, 2, 20);
+
+	}
+
+	@Override
+	public List<List<VoteWithValue>> getGeneralTestData() {
+		return Arrays.asList(Arrays.asList(vote1, vote1a), Arrays.asList(vote2),
+				Arrays.asList(vote3), Arrays.asList(vote4),
+				Arrays.asList(vote5), Arrays.asList(vote6));
+	}
+
+	@Override
+	public List<String> getGeneralTestStrings() {
+		return Arrays.asList(
+				"VoteWithValue.*party1.*issue2=10.*issue1=.value1.*1.*2.*10.*",
+				"VoteWithValue.*party2.*issue2=10.*issue1=.value1.*1.*2.*10.*",
+				"VoteWithValue.*party1.*issue2=10.*issue1=10.*1.*2.*10.*",
+				"VoteWithValue.*party1.*issue2=10.*issue1=.value1.*2.*2.*10.*",
+				"VoteWithValue.*party1.*issue2=10.*issue1=.value1.*1.*3.*10.*",
+				"VoteWithValue.*party1.*issue2=10.*issue1=.value1.*1.*2.*20.*");
+	}
+
+	@Before
+	public void before() {
+
+	}
+
+	@Test
+	public void serializeTest() throws JsonProcessingException {
+		System.out.println(jackson.writeValueAsString(vote1));
+		assertEquals(votestring, jackson.writeValueAsString(vote1));
+	}
+
+	@Test
+	public void deserializeAcceptTest() throws IOException {
+		Action act = jackson.readValue(votestring, Action.class);
+		assertEquals(vote1, act);
+	}
+
+}
Index: events/src/test/java/geniusweb/actions/VotesWithValueTest.java
===================================================================
--- events/src/test/java/geniusweb/actions/VotesWithValueTest.java	(revision 30)
+++ events/src/test/java/geniusweb/actions/VotesWithValueTest.java	(revision 30)
@@ -0,0 +1,149 @@
+package geniusweb.actions;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+
+import org.junit.Test;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+import geniusweb.issuevalue.Bid;
+import geniusweb.issuevalue.DiscreteValue;
+import tudelft.utilities.junit.GeneralTests;
+
+public class VotesWithValueTest extends GeneralTests<VotesWithValue> {
+	private final ObjectMapper jackson = new ObjectMapper();
+	private final String votestring = "{\"VotesWithValue\":{\"actor\":\"partyA\",\"votes\":[{\"votewithvalue\":{\"actor\":\"partyA\",\"bid\":{\"issuevalues\":{\"is1\":\"val1\"}},\"minPower\":2,\"maxPower\":9,\"value\":30}},{\"votewithvalue\":{\"actor\":\"partyA\",\"bid\":{\"issuevalues\":{\"is1\":\"val2\"}},\"minPower\":2,\"maxPower\":9,\"value\":70}}]}}";
+
+	private PartyId partyA = new PartyId("partyA");
+	private PartyId partyB = new PartyId("partyB");
+	private Bid bid1 = new Bid("is1", new DiscreteValue("val1")),
+			bid2 = new Bid("is1", new DiscreteValue("val2"));
+	private VoteWithValue voteA1 = new VoteWithValue(partyA, bid1, 2, 9, 30);
+	private VoteWithValue voteA2 = new VoteWithValue(partyA, bid2, 2, 9, 70);
+	private VoteWithValue voteA1_100 = new VoteWithValue(partyA, bid1, 2, 9,
+			100);
+	private VoteWithValue voteA2_100 = new VoteWithValue(partyA, bid2, 2, 9,
+			100);
+	private VoteWithValue voteB1 = new VoteWithValue(partyB, bid1, 2, 9, 40);
+	private VoteWithValue voteB2 = new VoteWithValue(partyB, bid2, 2, 9, 60);
+
+	private VotesWithValue votes1 = new VotesWithValue(partyA,
+			new HashSet<>(Arrays.asList(voteA1, voteA2)));
+	private VotesWithValue votes1a = new VotesWithValue(partyA,
+			new HashSet<>(Arrays.asList(voteA1, voteA2)));
+	private VotesWithValue votes2 = new VotesWithValue(partyB,
+			new HashSet<>(Arrays.asList(voteB1, voteB2)));
+
+	@Override
+	public List<List<VotesWithValue>> getGeneralTestData() {
+		return Arrays.asList(Arrays.asList(votes1, votes1a),
+				Arrays.asList(votes2));
+	}
+
+	@Override
+	public List<String> getGeneralTestStrings() {
+		return Arrays.asList(
+				"Votes.*Vote.*partyA,Bid.*is1.*val1.*2.*Vote.*partyA,Bid.*is1.*val2.*2.*",
+				"Votes.*Vote.*partyB,Bid.*is1.*val2.*2.*Vote.*partyB,Bid.*is1.*val1.*2.*");
+	}
+
+	@SuppressWarnings("unused")
+	@Test(expected = IllegalArgumentException.class)
+	public void testRejectVoteWithIncorrectParty() {
+		new VotesWithValue(partyA, Collections.singleton(voteB1));
+	}
+
+	@Test
+	public void serializeTest() throws JsonProcessingException {
+		System.out.println(jackson.writeValueAsString(votes1));
+		assertEquals(votestring, jackson.writeValueAsString(votes1));
+	}
+
+	@Test
+	public void deserializeTest() throws IOException {
+		Action act = jackson.readValue(votestring, Action.class);
+		assertEquals(votes1, act);
+	}
+
+	@Test(expected = IllegalArgumentException.class)
+	public void testWrongPartyName() {
+		new VotesWithValue(partyA,
+				new HashSet<>(Arrays.asList(voteB1, voteB2)));
+	}
+
+	@Test
+	public void isExtendingTestExtraVote() {
+		VotesWithValue otherVotes = new VotesWithValue(partyA,
+				Collections.singleton(voteA1_100));
+		assertTrue(votes1.isExtending(otherVotes));
+	}
+
+	@Test
+	public void isExtendingTestMissing() {
+		VotesWithValue otherVotes = new VotesWithValue(partyA,
+				Collections.singleton(voteA1_100));
+		assertFalse(otherVotes.isExtending(votes1));
+	}
+
+	@Test
+	public void isExtendingIdenticalVotes() {
+		assertTrue(votes1.isExtending(votes1));
+	}
+
+	@Test
+	public void isReallyExtendingVotesMin() {
+		VoteWithValue powervoteA1 = new VoteWithValue(partyA, bid1, 1, 9, 30);
+		VotesWithValue powerVotes = new VotesWithValue(partyA,
+				new HashSet<>(Arrays.asList(powervoteA1, voteA2)));
+		assertTrue(powerVotes.isExtending(votes1));
+	}
+
+	@Test
+	public void isReallyExtendingVotesMax() {
+		VoteWithValue powervoteA1 = new VoteWithValue(partyA, bid1, 2, 10, 30);
+		VotesWithValue powerVotes = new VotesWithValue(partyA,
+				new HashSet<>(Arrays.asList(powervoteA1, voteA2)));
+		assertTrue(powerVotes.isExtending(votes1));
+	}
+
+	@Test
+	public void IsNarrowingOneVoteRemoved() {
+		VotesWithValue narrowVotes = new VotesWithValue(partyA,
+				Collections.singleton(voteA2_100));
+		assertFalse(narrowVotes.isExtending(votes1));
+	}
+
+	@Test
+	public void isNarrowingTestMoreMinPower() {
+		VoteWithValue narrowVoteA1 = new VoteWithValue(partyA, bid1, 3, 9, 30);
+		VotesWithValue narrowVotes = new VotesWithValue(partyA,
+				new HashSet<>(Arrays.asList(narrowVoteA1, voteA2)));
+		assertFalse(narrowVotes.isExtending(votes1));
+		assertTrue(votes1.isExtending(narrowVotes));
+	}
+
+	@Test
+	public void isNarrowingLessMaxPower() {
+		VoteWithValue powervoteA1 = new VoteWithValue(partyA, bid1, 2, 8, 30);
+		VotesWithValue narrowVotes = new VotesWithValue(partyA,
+				new HashSet<>(Arrays.asList(powervoteA1, voteA2)));
+		assertFalse(narrowVotes.isExtending(votes1));
+		assertTrue(votes1.isExtending(narrowVotes));
+	}
+
+	@Test(expected = IllegalArgumentException.class)
+	public void testDuplicateBidsNotAllowed() {
+		VoteWithValue voteA1similar = new VoteWithValue(partyA, bid1, 3, 9, 30);
+		VotesWithValue votes = new VotesWithValue(partyA,
+				new HashSet<>(Arrays.asList(voteA1, voteA1similar)));
+	}
+}
