source: src/test/java/genius/core/parties/NegotiationPartyInternalTest.java

Last change on this file was 78, checked in by Wouter Pasman, 6 years ago

#30 use UncertainAdditiveUtilitySpace.

File size: 2.1 KB
Line 
1package genius.core.parties;
2
3import static org.junit.Assert.assertNotNull;
4import static org.mockito.Mockito.mock;
5import static org.mockito.Mockito.when;
6
7import org.junit.Test;
8
9import genius.core.AgentID;
10import genius.core.Deadline;
11import genius.core.Domain;
12import genius.core.exceptions.InstantiateException;
13import genius.core.exceptions.NegotiatorException;
14import genius.core.persistent.PersistentDataType;
15import genius.core.repository.PartyRepItem;
16import genius.core.repository.ProfileRepItem;
17import genius.core.session.RepositoryException;
18import genius.core.session.Session;
19import genius.core.timeline.Timeline;
20import genius.core.utility.UncertainAdditiveUtilitySpace;
21
22public class NegotiationPartyInternalTest {
23 /**
24 * Test that NegotiationPartyInternal recognises the utilityspace is of type
25 * {@link UncertainAdditiveUtilitySpace} and then generates a UncertainModel
26 *
27 * @throws RepositoryException
28 * @throws NegotiatorException
29 * @throws InstantiateException
30 */
31 @Test
32 public void testUncertainAdditive() throws RepositoryException,
33 NegotiatorException, InstantiateException {
34 Domain domain = mock(Domain.class);
35
36 UncertainAdditiveUtilitySpace utilspace = mock(
37 UncertainAdditiveUtilitySpace.class);
38 when(utilspace.copy()).thenReturn(utilspace);
39 when(utilspace.getDomain()).thenReturn(domain);
40
41 PartyRepItem partyrep = mock(PartyRepItem.class);
42 ProfileRepItem profilerep = mock(ProfileRepItem.class);
43 when(profilerep.create()).thenReturn(utilspace);
44
45 Session session = mock(Session.class);
46 when(session.getDeadlines()).thenReturn(mock(Deadline.class));
47 when(session.getTimeline()).thenReturn(mock(Timeline.class));
48
49 SessionsInfo info = mock(SessionsInfo.class);
50 when(info.getPersistentDataType())
51 .thenReturn(PersistentDataType.DISABLED);
52
53 AgentID agentid = mock(AgentID.class);
54
55 NegotiationParty party = mock(NegotiationParty.class);
56 when(partyrep.load()).thenReturn(party);
57
58 NegotiationPartyInternal partyint = new NegotiationPartyInternal(
59 partyrep, profilerep, session, info, agentid);
60
61 assertNotNull(partyint.getUncertainModel());
62
63 }
64}
Note: See TracBrowser for help on using the repository browser.