Index: protocol/src/test/java/geniusweb/protocol/WillBeCalledTest.java
===================================================================
--- protocol/src/test/java/geniusweb/protocol/WillBeCalledTest.java	(revision 25)
+++ 	(revision )
@@ -1,37 +1,0 @@
-package geniusweb.protocol;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Test;
-
-public class WillBeCalledTest {
-	int counter;
-
-	@Test
-	public void testDeadline() throws InterruptedException {
-		counter = 0;
-		new WillBeCalled(() -> {
-			counter++;
-		}, 100l);
-		assertEquals(0, counter);
-		Thread.sleep(200);
-		assertEquals(1, counter);
-		Thread.sleep(200);
-		assertEquals(1, counter);
-
-	}
-
-	@Test
-	public void testManual() throws InterruptedException {
-		counter = 0;
-		WillBeCalled w = new WillBeCalled(() -> {
-			counter++;
-		}, 100l);
-		assertEquals(0, counter);
-		w.complete();
-		assertEquals(1, counter);
-		Thread.sleep(200);
-		assertEquals(1, counter);
-
-	}
-}
Index: protocol/src/test/java/geniusweb/protocol/session/SessionResultTest.java
===================================================================
--- protocol/src/test/java/geniusweb/protocol/session/SessionResultTest.java	(revision 25)
+++ protocol/src/test/java/geniusweb/protocol/session/SessionResultTest.java	(revision 26)
@@ -67,6 +67,6 @@
 		issuevalues1.put(ISSUE1, new DiscreteValue("a"));
 		Bid bid1 = new Bid(issuevalues1);
-		Agreements agreement1 = new Agreements().with(bid1,
-				new HashSet<>(Arrays.asList(PARTY1, PARTY2)));
+		Agreements agreement1 = new Agreements().with(new Agreements(bid1,
+				new HashSet<>(Arrays.asList(PARTY1, PARTY2))));
 
 		// different order but that shouldn't matter
@@ -74,6 +74,6 @@
 		issuevalues2.put(ISSUE1, new DiscreteValue("b"));
 		Bid bid2 = new Bid(issuevalues2);
-		Agreements agreement2 = new Agreements().with(bid2,
-				new HashSet<>(Arrays.asList(PARTY1, PARTY3)));
+		Agreements agreement2 = new Agreements().with(new Agreements(bid2,
+				new HashSet<>(Arrays.asList(PARTY1, PARTY3))));
 
 		Map<PartyId, PartyWithProfile> partiesmap = new HashMap<>();
Index: protocol/src/test/java/geniusweb/protocol/session/amop/AMOPStateTest.java
===================================================================
--- protocol/src/test/java/geniusweb/protocol/session/amop/AMOPStateTest.java	(revision 25)
+++ protocol/src/test/java/geniusweb/protocol/session/amop/AMOPStateTest.java	(revision 26)
@@ -275,6 +275,6 @@
 	@Test
 	public void activePartiesAgreedTest() {
-		Agreements agreements = new Agreements().with(bid1,
-				new HashSet<>(Arrays.asList(party1, party2)));
+		Agreements agreements = new Agreements().with(new Agreements(bid1,
+				new HashSet<>(Arrays.asList(party1, party2))));
 		AMOPState state = new AMOPState(Phase.INIT, actions, connections3,
 				progressrounds, settings, partyprofiles1, agreements,
@@ -376,12 +376,12 @@
 	@Test
 	public void testCollectVotes() {
-		Votes vote1AB = new Votes(party1, Arrays
-				.asList(new Vote(party1, a, 2, 9), new Vote(party1, b, 2, 9)));
-		Votes vote2AB = new Votes(party2, Arrays
-				.asList(new Vote(party2, a, 2, 9), new Vote(party2, b, 2, 9)));
+		Votes vote1AB = new Votes(party1, new HashSet<>(Arrays
+				.asList(new Vote(party1, a, 2, 9), new Vote(party1, b, 2, 9))));
+		Votes vote2AB = new Votes(party2, new HashSet<>(Arrays
+				.asList(new Vote(party2, a, 2, 9), new Vote(party2, b, 2, 9))));
 		Votes vote3C = new Votes(party3,
-				Arrays.asList(new Vote(party3, c, 2, 9)));
-		Votes vote4AC = new Votes(party4, Arrays
-				.asList(new Vote(party4, a, 2, 9), new Vote(party4, c, 2, 9)));
+				Collections.singleton(new Vote(party3, c, 2, 9)));
+		Votes vote4AC = new Votes(party4, new HashSet<>(Arrays
+				.asList(new Vote(party4, a, 2, 9), new Vote(party4, c, 2, 9))));
 		// party 1,2,4 vote for A, party 1,2 vote for B, party 3,4 vote for C.
 		// the biggest vote is P,Q,S
@@ -409,12 +409,12 @@
 	public void testNextPhase() {
 		// copy of above. todo cleanup
-		Votes vote1AB = new Votes(party1, Arrays
-				.asList(new Vote(party1, a, 2, 9), new Vote(party1, b, 2, 9)));
-		Votes vote2AB = new Votes(party2, Arrays
-				.asList(new Vote(party2, a, 2, 9), new Vote(party2, b, 2, 9)));
+		Votes vote1AB = new Votes(party1, new HashSet<>(Arrays
+				.asList(new Vote(party1, a, 2, 9), new Vote(party1, b, 2, 9))));
+		Votes vote2AB = new Votes(party2, new HashSet<>(Arrays
+				.asList(new Vote(party2, a, 2, 9), new Vote(party2, b, 2, 9))));
 		Votes vote3C = new Votes(party3,
-				Arrays.asList(new Vote(party3, c, 2, 9)));
-		Votes vote4AC = new Votes(party4, Arrays
-				.asList(new Vote(party4, a, 2, 9), new Vote(party4, c, 2, 9)));
+				Collections.singleton(new Vote(party3, c, 2, 9)));
+		Votes vote4AC = new Votes(party4, new HashSet<>(Arrays
+				.asList(new Vote(party4, a, 2, 9), new Vote(party4, c, 2, 9))));
 		// party 1,2,4 vote for A, party 1,2 vote for B, party 3,4 vote for C.
 		// the biggest vote is P,Q,S
Index: protocol/src/test/java/geniusweb/protocol/session/mopac/phase/OfferPhaseTest.java
===================================================================
--- protocol/src/test/java/geniusweb/protocol/session/mopac/phase/OfferPhaseTest.java	(revision 25)
+++ protocol/src/test/java/geniusweb/protocol/session/mopac/phase/OfferPhaseTest.java	(revision 26)
@@ -135,6 +135,5 @@
 	@Test(expected = ProtocolException.class)
 	public void checkNotAllowedActionTest() throws ProtocolException {
-		phase.checkAction(party1, new Votes(party2, Collections.emptyList()),
-				1);
+		phase.checkAction(party1, new Votes(party2, Collections.emptySet()), 1);
 	}
 
@@ -241,6 +240,7 @@
 	public void getOffersTest() {
 		assertEquals(Collections.emptyList(), phase.getOffers());
-		List<Bid> offs = phase.with(party1, offer, 1).getOffers();
-		assertEquals(Arrays.asList(bid), offs);
+		List<Offer> offs = phase.with(party1, offer, 1).getOffers();
+		assertEquals(1, offs.size());
+		assertEquals(bid, offs.get(0).getBid());
 	}
 
Index: protocol/src/test/java/geniusweb/protocol/session/mopac/phase/OptInPhaseTest.java
===================================================================
--- protocol/src/test/java/geniusweb/protocol/session/mopac/phase/OptInPhaseTest.java	(revision 25)
+++ protocol/src/test/java/geniusweb/protocol/session/mopac/phase/OptInPhaseTest.java	(revision 26)
@@ -50,5 +50,5 @@
 	private final Bid bid = new Bid("issue", new DiscreteValue("yes"));
 	private final Vote vote = new Vote(party1, bid, 2, 3);
-	private final Votes votes = new Votes(party1, Arrays.asList(vote));
+	private final Votes votes = new Votes(party1, Collections.singleton(vote));
 
 	private final List<Votes> prevVotes = Arrays.asList(votes);
@@ -135,6 +135,5 @@
 	@Test(expected = ProtocolException.class)
 	public void checkNotAllowedActionTest() throws ProtocolException {
-		phase.checkAction(party1, new Votes(party2, Collections.emptyList()),
-				1);
+		phase.checkAction(party1, new Votes(party2, Collections.emptySet()), 1);
 	}
 
@@ -175,5 +174,5 @@
 		// so this is an illegal narrowing of the previous vote
 		Vote newVote = new Vote(party1, bid, 2, 2);
-		Votes newVotes = new Votes(party1, Arrays.asList(newVote));
+		Votes newVotes = new Votes(party1, Collections.singleton(newVote));
 
 		// when(prevPhase.getVotes()).thenReturn(Arrays.asList(votes));
Index: protocol/src/test/java/geniusweb/protocol/session/mopac/phase/VotingPhaseTest.java
===================================================================
--- protocol/src/test/java/geniusweb/protocol/session/mopac/phase/VotingPhaseTest.java	(revision 25)
+++ protocol/src/test/java/geniusweb/protocol/session/mopac/phase/VotingPhaseTest.java	(revision 26)
@@ -16,4 +16,5 @@
 
 import geniusweb.actions.EndNegotiation;
+import geniusweb.actions.Offer;
 import geniusweb.actions.PartyId;
 import geniusweb.actions.Vote;
@@ -50,7 +51,7 @@
 	private final Bid bid = new Bid("issue", new DiscreteValue("yes"));
 	private final Vote vote = new Vote(party1, bid, 2, 3);
-	private final Votes votes = new Votes(party1, Arrays.asList(vote));
+	private final Votes votes = new Votes(party1, Collections.singleton(vote));
 
-	private final List<Bid> prevPhase = Arrays.asList(bid);
+	private final List<Offer> prevPhase = Arrays.asList(new Offer(party1, bid));
 
 	public VotingPhaseTest() {
@@ -101,5 +102,6 @@
 	public void testInform() {
 		// when(prevPhase.getOffers()).thenReturn(Arrays.asList(bid));
-		assertEquals(new Voting(Arrays.asList(bid), powers), phase.getInform());
+		assertEquals(new Voting(Arrays.asList(new Offer(party1, bid)), powers),
+				phase.getInform());
 
 	}
@@ -135,6 +137,5 @@
 	@Test(expected = ProtocolException.class)
 	public void checkNotAllowedActionTest() throws ProtocolException {
-		phase.checkAction(party1, new Votes(party2, Collections.emptyList()),
-				1);
+		phase.checkAction(party1, new Votes(party2, Collections.emptySet()), 1);
 	}
 
Index: protocol/src/test/java/geniusweb/protocol/tournament/AllPermutationsProtocolTest.java
===================================================================
--- protocol/src/test/java/geniusweb/protocol/tournament/AllPermutationsProtocolTest.java	(revision 25)
+++ 	(revision )
@@ -1,181 +1,0 @@
-package geniusweb.protocol.tournament;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.anyLong;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-import java.math.BigInteger;
-import java.util.LinkedList;
-import java.util.List;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.ArgumentCaptor;
-
-import geniusweb.events.ProtocolEvent;
-import geniusweb.issuevalue.Bid;
-import geniusweb.protocol.CurrentNegoState;
-import geniusweb.protocol.NegoState;
-import geniusweb.protocol.SessionResult;
-import geniusweb.protocol.partyconnection.ProtocolToPartyConnFactory;
-import geniusweb.protocol.session.SessionProtocol;
-import geniusweb.protocol.session.SessionSettings;
-import geniusweb.protocol.session.SessionState;
-import geniusweb.protocol.tournament.allpermutations.AllPermutationsProtocol;
-import geniusweb.protocol.tournament.allpermutations.AllPermutationsState;
-import geniusweb.references.PartyWithProfile;
-import geniusweb.references.ProtocolRef;
-import tudelft.utilities.listener.Listener;
-import tudelft.utilities.logging.ReportToLogger;
-
-public class AllPermutationsProtocolTest {
-
-	private final AllPermutationsState state = mock(AllPermutationsState.class),
-			newstate = mock(AllPermutationsState.class);
-	private final ReportToLogger log = new ReportToLogger("test");
-	private final AllPermutationsProtocol app = new AllPermutationsProtocol(
-			state, log);
-	private final ProtocolToPartyConnFactory factory = mock(
-			ProtocolToPartyConnFactory.class);
-	private final SessionSettings settings = mock(SessionSettings.class);
-	private final SessionState finalsessionstate = mock(SessionState.class);
-	private Bid agreement = mock(Bid.class);
-	private final long NOW = 1000;
-
-	@Before
-	public void before() {
-		when(state.getSize()).thenReturn(BigInteger.ZERO);
-		when(finalsessionstate.isFinal(anyLong())).thenReturn(true);
-		when(finalsessionstate.getSettings()).thenReturn(settings);
-		when(finalsessionstate.getAgreement()).thenReturn(agreement);
-		when(state.with(any())).thenReturn(newstate);
-	}
-
-	@Test
-	public void smokeTest() {
-	}
-
-	@Test
-	public void startTestNoSessions() {
-		AllPermutationsProtocol app = new AllPermutationsProtocol(state, log);
-		app.start(factory);
-
-	}
-
-	@Test
-	public void getDescrTest() {
-		assertNotNull(app.getDescription());
-	}
-
-	@Test
-	public void getStateTest() {
-		assertEquals(state, app.getState());
-	}
-
-	@Test
-	public void getRefTest() {
-		assertEquals("APP", app.getRef().getURI().toString());
-	}
-
-	@Test
-	public void runOneSessionTest() throws InterruptedException {
-		MockSessionProtocol sessionprotocol = startSession();
-		sessionprotocol.getListener();
-	}
-
-	@Test
-	public void runOneSessionAndUnhandledEvent() throws InterruptedException {
-		MockSessionProtocol sessionprotocol = startSession();
-		sessionprotocol.getListener().notifyChange(mock(ProtocolEvent.class));
-		verify(state, times(0)).with(any());
-	}
-
-	/**
-	 * Check that a started session correctly handles a session event.
-	 */
-	@Test
-	public void CurrentNegoStateEventTest() throws InterruptedException {
-		MockSessionProtocol sessionprotocol = startSession();
-
-		CurrentNegoState evt = mock(CurrentNegoState.class);
-		when(evt.getState()).thenReturn(finalsessionstate);
-		sessionprotocol.getListener().notifyChange(evt);
-
-		ArgumentCaptor<SessionResult> argument = ArgumentCaptor
-				.forClass(SessionResult.class);
-		verify(state, times(1)).with(argument.capture());
-		assertEquals(agreement, argument.getValue().getAgreement());
-		assertNull(argument.getValue().getError());
-	}
-
-	private MockSessionProtocol startSession() throws InterruptedException {
-		SessionSettings setting = mock(SessionSettings.class);
-		MockSessionProtocol sessionprotocol = new MockSessionProtocol();
-		when(setting.getProtocol(log)).thenReturn(sessionprotocol);
-		when(state.getNextSettings()).thenReturn(setting);
-
-		app.start(factory);
-		Thread.sleep(500); // allow app to start session
-		// this call should return fine, and have listener registered to our
-		// protocol. app now waits for a notification
-		return sessionprotocol;
-	}
-
-}
-
-/**
- * 
- * The protocol needs to record the listners, we need a listener to trigger
- * further protocol actions. Mockito can't handle this, we mneed our own mock...
- *
- */
-class MockSessionProtocol implements SessionProtocol {
-	private final List<Listener<ProtocolEvent>> listeners = new LinkedList<>();
-
-	@Override
-	public void start(ProtocolToPartyConnFactory connectionfactory) {
-
-	}
-
-	@Override
-	public String getDescription() {
-		return null;
-	}
-
-	@Override
-	public NegoState getState() {
-		return null;
-	}
-
-	@Override
-	public ProtocolRef getRef() {
-		return null;
-	}
-
-	@Override
-	public void addParticipant(PartyWithProfile party) {
-	}
-
-	@Override
-	public void addListener(Listener<ProtocolEvent> l) {
-		listeners.add(l);
-	}
-
-	@Override
-	public void removeListener(Listener<ProtocolEvent> l) {
-	}
-
-	public Listener<ProtocolEvent> getListener() {
-		if (listeners.size() != 1) {
-			throw new IllegalStateException("Not having exactly 1 listener");
-		}
-		return listeners.get(0);
-	}
-
-}
Index: protocol/src/test/java/geniusweb/protocol/tournament/AllPermutationsSettingsTest.java
===================================================================
--- protocol/src/test/java/geniusweb/protocol/tournament/AllPermutationsSettingsTest.java	(revision 25)
+++ 	(revision )
@@ -1,180 +1,0 @@
-package geniusweb.protocol.tournament;
-
-import static org.junit.Assert.assertEquals;
-
-import java.io.IOException;
-import java.math.BigInteger;
-import java.net.URISyntaxException;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-
-import org.junit.Before;
-import org.junit.Test;
-
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.ObjectMapper;
-
-import geniusweb.deadline.DeadlineTime;
-import geniusweb.protocol.session.saop.SAOPSettings;
-import geniusweb.protocol.tournament.allpermutations.AllPermutationsSettings;
-import geniusweb.references.Parameters;
-import geniusweb.references.PartyRef;
-import geniusweb.references.PartyWithParameters;
-import geniusweb.references.ProfileRef;
-import tudelft.utilities.junit.GeneralTests;
-import tudelft.utilities.logging.ReportToLogger;
-
-public class AllPermutationsSettingsTest
-		extends GeneralTests<AllPermutationsSettings> {
-
-	private final ObjectMapper jackson = new ObjectMapper();
-
-	private final String serialized = "{\"AllPermutationsSettings\":{\"parties\":[{\"partyref\":\"party1\",\"parameters\":{}},{\"partyref\":\"party2\",\"parameters\":{}}],\"reuseParties\":false,\"profiles\":[\"profile1\",\"profile2\",\"profile3\"],\"partiesPerSession\":2,\"sessionsettings\":{\"SAOPSettings\":{\"participants\":[],\"deadline\":{\"deadlinetime\":{\"durationms\":10000}}}}}}";
-	private AllPermutationsSettings settings, settings1a, settings2, settings3,
-			settings4;
-
-	private SAOPSettings saopsettings;
-
-	private ProfileRef profile1, profile2, profile3;
-
-	private List<PartyWithParameters> parties;
-
-	@Before
-	public void before() throws URISyntaxException {
-		PartyRef partyref1 = new PartyRef("party1");
-		PartyRef partyref2 = new PartyRef("party2");
-		PartyRef partyref3 = new PartyRef("party3");
-
-		Parameters params1 = new Parameters();
-		Parameters params2 = new Parameters();
-		Parameters params3 = new Parameters();
-
-		PartyWithParameters partywithparams1 = new PartyWithParameters(
-				partyref1, params1);
-		PartyWithParameters partywithparams2 = new PartyWithParameters(
-				partyref2, params2);
-		PartyWithParameters partywithparams3 = new PartyWithParameters(
-				partyref3, params3);
-
-		parties = Arrays.asList(partywithparams1, partywithparams2);
-		DeadlineTime deadline = new DeadlineTime(10000);
-
-		saopsettings = new SAOPSettings(Collections.emptyList(), deadline);
-
-		profile1 = new ProfileRef("profile1");
-		profile2 = new ProfileRef("profile2");
-		profile3 = new ProfileRef("profile3");
-
-		List<ProfileRef> profiles = Arrays.asList(profile1, profile2, profile3);
-
-		settings = new AllPermutationsSettings(parties, false, profiles, 2,
-				saopsettings);
-
-		settings1a = new AllPermutationsSettings(parties, false, profiles, 2,
-				saopsettings);
-
-		settings2 = new AllPermutationsSettings(Arrays.asList(partywithparams1,
-				partywithparams2, partywithparams3), false, profiles, 2,
-				saopsettings);
-
-		settings3 = new AllPermutationsSettings(parties, true, profiles, 2,
-				saopsettings);
-
-		settings4 = new AllPermutationsSettings(parties, false,
-				Arrays.asList(profile1, profile2, profile3, profile1), 2,
-				saopsettings);
-
-	}
-
-	@Override
-	public List<List<AllPermutationsSettings>> getGeneralTestData() {
-		return Arrays.asList(Arrays.asList(settings, settings1a),
-				Arrays.asList(settings2), Arrays.asList(settings3),
-				Arrays.asList(settings4));
-	}
-
-	@Override
-	public List<String> getGeneralTestStrings() {
-		return Arrays.asList(
-				"AllPermutationsSettings.*party1.*party2.*,false,.*profile1.*profile2.*profile3.*,2,SAOPSettings.*",
-				"AllPermutationsSettings.*party1.*party2.*party3.*,false,.*profile1.*profile2.*profile3.*,2,SAOPSettings.*",
-				"AllPermutationsSettings.*party1.*party2.*,true,.*profile1.*profile2.*profile3.*,2,SAOPSettings.*",
-				"AllPermutationsSettings.*party1.*party2.*,false,.*profile1.*profile2.*profile3.*profile1.*,2,SAOPSettings.*");
-	}
-
-	@Test
-	public void getProtocolTest() {
-		assertEquals("APP", settings.getProtocol(new ReportToLogger("test"))
-				.getRef().getURI().toString());
-	}
-
-	@Test
-	public void testDeserialize() throws IOException {
-		TournamentSettings obj = jackson.readValue(serialized,
-				TournamentSettings.class);
-		System.out.println(obj);
-		assertEquals(settings, obj);
-	}
-
-	@Test
-	public void testSerialize()
-			throws JsonProcessingException, URISyntaxException {
-
-		String string = jackson.writeValueAsString(settings);
-		System.out.println(string);
-		assertEquals(serialized, string);
-	}
-
-	@Test(expected = IllegalArgumentException.class)
-	public void testNullParties() {
-		new AllPermutationsSettings(null, true,
-				Arrays.asList(profile1, profile2, profile3, profile1), 2,
-				saopsettings);
-
-	}
-
-	@Test(expected = IllegalArgumentException.class)
-	public void testNoParties() {
-		new AllPermutationsSettings(Collections.emptyList(), true,
-				Arrays.asList(profile1, profile2, profile3, profile1), 2,
-				saopsettings);
-
-	}
-
-	@Test(expected = IllegalArgumentException.class)
-	public void testNullProfiles() {
-		new AllPermutationsSettings(parties, true, null, 2, saopsettings);
-
-	}
-
-	@Test(expected = IllegalArgumentException.class)
-	public void testInsufficientProfiles() {
-		new AllPermutationsSettings(parties, true,
-				Arrays.asList(profile1, profile2, profile3, profile1), 4,
-				saopsettings);
-
-	}
-
-	@Test(expected = IllegalArgumentException.class)
-	public void testNullSessionSettings() {
-		new AllPermutationsSettings(parties, true,
-				Arrays.asList(profile1, profile2, profile3, profile1), 4, null);
-
-	}
-
-	@Test(expected = IllegalArgumentException.class)
-	public void testOnePartyPerSession() {
-		new AllPermutationsSettings(parties, true,
-				Arrays.asList(profile1, profile2, profile3, profile1), 1,
-				saopsettings);
-
-	}
-
-	@Test
-	public void getMaxRuntimeTest() {
-		assertEquals(BigInteger.valueOf(6), settings.permutations().size());
-		assertEquals((Double) (6d * 12), settings.getMaxRunTime());
-	}
-
-}
Index: protocol/src/test/java/geniusweb/protocol/tournament/AllPermutationsStateTest.java
===================================================================
--- protocol/src/test/java/geniusweb/protocol/tournament/AllPermutationsStateTest.java	(revision 25)
+++ 	(revision )
@@ -1,96 +1,0 @@
-package geniusweb.protocol.tournament;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-import java.math.BigInteger;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.junit.Test;
-
-import geniusweb.protocol.SessionResult;
-import geniusweb.protocol.session.SessionSettings;
-import geniusweb.protocol.tournament.allpermutations.AllPermutationsSettings;
-import geniusweb.protocol.tournament.allpermutations.AllPermutationsState;
-import geniusweb.references.PartyWithProfile;
-import tudelft.utilities.immutablelist.ImmutableList;
-
-public class AllPermutationsStateTest {
-
-	private final AllPermutationsSettings toursettings = mock(
-			AllPermutationsSettings.class);;
-	@SuppressWarnings("unchecked")
-	private final List<SessionResult> results = mock(List.class);
-	@SuppressWarnings("unchecked")
-	private final ImmutableList<SessionSettings> settings = mock(
-			ImmutableList.class);
-	private final AllPermutationsState state = new AllPermutationsState(
-			toursettings, settings, results);
-	private final SessionSettings session7settings = mock(
-			SessionSettings.class);
-	private final long NOW = 1000;
-
-	@SuppressWarnings("unchecked")
-	private final List<PartyWithProfile> participants = mock(List.class);
-
-	@Test
-	public void getResultsTest() {
-		assertEquals(results, state.getResults());
-	}
-
-	@Test
-	public void isFinalTestFalse() {
-		when(settings.size()).thenReturn(BigInteger.TEN);
-		when(results.size()).thenReturn(11);
-		assertFalse(state.isFinal(NOW));
-	}
-
-	@Test
-	public void isFinalTestTrue() {
-		when(settings.size()).thenReturn(BigInteger.TEN);
-		when(results.size()).thenReturn(10);
-		assertTrue(state.isFinal(NOW));
-	}
-
-	@Test
-	public void getNextSetting() {
-		prepareNextSettings();
-		assertEquals(session7settings, state.getNextSettings());
-	}
-
-	private void prepareNextSettings() {
-		when(results.size()).thenReturn(7); // result 0..6
-		when(settings.size()).thenReturn(BigInteger.TEN);
-		when(session7settings.getParticipants()).thenReturn(participants);
-		when(settings.get(BigInteger.valueOf(7))).thenReturn(session7settings);
-
-	}
-
-	@Test
-	public void withTest() {
-		prepareNextSettings();
-		ArrayList<SessionResult> results1 = new ArrayList<>();
-		for (int n = 0; n < 7; n++) {
-			results1.add(mock(SessionResult.class));
-		}
-		// use state with "real" results... to allow array copy in with
-		AllPermutationsState state = new AllPermutationsState(toursettings,
-				settings, results1);
-
-		when(settings.size()).thenReturn(BigInteger.TEN);
-		when(settings.get(BigInteger.valueOf(7))).thenReturn(session7settings);
-
-		SessionResult result = mock(SessionResult.class);
-		when(result.getParticipants()).thenReturn(participants);
-		AllPermutationsState state1 = state.with(result);
-
-		assertEquals(null, state1.getError());
-		assertEquals(8, state1.getResults().size());
-		assertEquals(toursettings, state1.getSettings());
-
-	}
-}
