source: src/test/java/negotiator/parties/NegotiationPartyInternalTest.java

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

#30 use UncertainAdditiveUtilitySpace.

File size: 2.4 KB
Line 
1package negotiator.parties;
2
3import static org.mockito.Mockito.mock;
4import static org.mockito.Mockito.when;
5
6import java.io.IOException;
7import java.net.URL;
8
9import org.junit.Test;
10
11import genius.core.AgentID;
12import genius.core.Deadline;
13import genius.core.exceptions.InstantiateException;
14import genius.core.exceptions.NegotiatorException;
15import genius.core.parties.NegotiationPartyInternal;
16import genius.core.parties.SessionsInfo;
17import genius.core.persistent.PersistentDataType;
18import genius.core.repository.DomainRepItem;
19import genius.core.repository.PartyRepItem;
20import genius.core.repository.ProfileRepItem;
21import genius.core.session.RepositoryException;
22import genius.core.session.Session;
23import genius.core.timeline.Timeline;
24
25public class NegotiationPartyInternalTest {
26 private static final String PARTY1_UTIL = "file:src/test/resources/partydomain/party1_utility.xml";
27 private static final String DOMAIN_REPO = "file:src/test/resources/partydomain/party_domain.xml";
28
29 @Test
30 public void createParty() throws InstantiateException, RepositoryException,
31 NegotiatorException, IOException {
32 PartyRepItem partyRepItem = new PartyRepItem(
33 "agents.nastyagent.NullBid");
34 DomainRepItem domain = new DomainRepItem(new URL(DOMAIN_REPO));
35 ProfileRepItem profileRepItem = new ProfileRepItem(new URL(PARTY1_UTIL),
36 domain);
37
38 Session session = mock(Session.class);
39 Timeline timeline = mock(Timeline.class);
40 Deadline deadline = mock(Deadline.class);
41 when(session.getTimeline()).thenReturn(timeline);
42 when(session.getDeadlines()).thenReturn(deadline);
43 SessionsInfo info = new SessionsInfo(null, PersistentDataType.DISABLED,
44 true);
45 new NegotiationPartyInternal(partyRepItem, profileRepItem, session,
46 info, new AgentID("testname"));
47
48 }
49
50 @Test(expected = NullPointerException.class)
51 public void createPartyWithNullID() throws InstantiateException,
52 RepositoryException, NegotiatorException, IOException {
53 PartyRepItem partyRepItem = new PartyRepItem(
54 "agents.nastyagent.NullBid");
55 DomainRepItem domain = new DomainRepItem(new URL(DOMAIN_REPO));
56 ProfileRepItem profileRepItem = new ProfileRepItem(new URL(PARTY1_UTIL),
57 domain);
58
59 Session session = mock(Session.class);
60 SessionsInfo info = new SessionsInfo(null, PersistentDataType.DISABLED,
61 true);
62 new NegotiationPartyInternal(partyRepItem, profileRepItem, session,
63 info, null);
64
65 }
66
67}
Note: See TracBrowser for help on using the repository browser.