1 | package genius.core.parties;
|
---|
2 |
|
---|
3 | import static org.junit.Assert.assertNotNull;
|
---|
4 | import static org.mockito.Mockito.mock;
|
---|
5 | import static org.mockito.Mockito.when;
|
---|
6 |
|
---|
7 | import org.junit.Test;
|
---|
8 |
|
---|
9 | import genius.core.AgentID;
|
---|
10 | import genius.core.Deadline;
|
---|
11 | import genius.core.Domain;
|
---|
12 | import genius.core.exceptions.InstantiateException;
|
---|
13 | import genius.core.exceptions.NegotiatorException;
|
---|
14 | import genius.core.persistent.PersistentDataType;
|
---|
15 | import genius.core.repository.PartyRepItem;
|
---|
16 | import genius.core.repository.ProfileRepItem;
|
---|
17 | import genius.core.session.RepositoryException;
|
---|
18 | import genius.core.session.Session;
|
---|
19 | import genius.core.timeline.Timeline;
|
---|
20 | import genius.core.utility.UncertainAdditiveUtilitySpace;
|
---|
21 |
|
---|
22 | public 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 | }
|
---|