forked from CavemanCraig/FBTutorialDemo
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPlayerTest.java
More file actions
59 lines (48 loc) · 1.91 KB
/
Copy pathPlayerTest.java
File metadata and controls
59 lines (48 loc) · 1.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
package com.example.domain;
import java.util.ArrayList;
import javax.inject.Inject;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.asset.EmptyAsset;
import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
@RunWith(Arquillian.class)
public class PlayerTest {
@Inject private MyWebService myWebService;
@Deployment public static WebArchive createDeployment() {
return ShrinkWrap.create(WebArchive.class, "test.war")
.addClasses(MyWebService.class)
.addClasses(User.class)
.addClasses(Player.class)
.addClasses(Link.class)
.addAsResource("META-INF/persistence.xml")
.addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml");
}
@Test
public void testIsDeployed() {
Assert.assertNotNull(myWebService);
}
@Test
public void testPlayerInContainer(){
ArrayList<String> friendIDList = new ArrayList<String>();
friendIDList.add("newArray");
friendIDList.add("67890");
friendIDList.add("newArray");
friendIDList.add("One Friend");
Player player = myWebService.playerPOSTRequest(999, "Ima Player", friendIDList);
User user = myWebService.getUser(67890);
//Asserts after POST
Assert.assertTrue(player.getFriendList().size()==1);
Assert.assertTrue(player.getPlayerInfo().getName().equals("Ima Player"));
Assert.assertTrue(user.getImageURL().equals(myWebService.resolveURL(67890)));
long points = myWebService.getPlayerPoints(999);
//Assert after GET
Assert.assertTrue(points==100);
//Remove the Player and make sure it happened
String result = myWebService.playerRemovalRequest(999);
Assert.assertTrue(result.equals("Player removed with FacbookID: 999"));
}
}