forked from mraho/codesamples-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInvoiceTest.java
More file actions
100 lines (86 loc) · 3.29 KB
/
InvoiceTest.java
File metadata and controls
100 lines (86 loc) · 3.29 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
package com.sample;
import org.testng.Assert;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import com.paypal.svcs.types.pt.CreateAndSendInvoiceResponse;
import com.paypal.svcs.types.pt.CreateInvoiceResponse;
import com.paypal.svcs.types.pt.GetInvoiceDetailsResponse;
import com.paypal.svcs.types.pt.SearchInvoicesResponse;
import com.paypal.svcs.types.pt.SendInvoiceResponse;
import com.paypal.svcs.types.pt.UpdateInvoiceResponse;
import com.sample.invoice.CreateAndSendInvoice;
import com.sample.invoice.CreateInvoice;
import com.sample.invoice.GetInvoiceDetails;
import com.sample.invoice.SearchInvoices;
import com.sample.invoice.SendInvoice;
import com.sample.invoice.UpdateInvoice;
public class InvoiceTest {
CreateInvoice createInvoice;
CreateAndSendInvoice createAndSendInvoice;
SendInvoice sendInvoice;
UpdateInvoice updateInvoice;
SearchInvoices searchInvoices;
GetInvoiceDetails getInvoiceDetails;
@Test(groups = { "automate" })
public void createInvoiceTest() {
CreateInvoiceResponse createInvoiceResponse = createInvoice
.createInvoice();
Assert.assertEquals(createInvoiceResponse.getResponseEnvelope()
.getAck().getValue().toString(), "Success");
Assert.assertNotNull(createInvoiceResponse.getInvoiceID());
}
@Test(groups = { "automate" })
public void createAndSendInvoiceTest() {
CreateAndSendInvoiceResponse createAndSendInvoiceResponse = createAndSendInvoice
.createAndSendInvoice();
Assert.assertEquals(createAndSendInvoiceResponse.getResponseEnvelope()
.getAck().getValue().toString(), "Success");
Assert.assertNotNull(createAndSendInvoiceResponse.getInvoiceID());
}
@Test(groups = { "automate" })
public void updateInvoiceTest() {
UpdateInvoiceResponse updateInvoiceResponse = updateInvoice
.updateInvoice();
Assert.assertEquals(updateInvoiceResponse.getResponseEnvelope()
.getAck().getValue().toString(), "Success");
}
@Test(groups = { "automate" })
public void getInvoiceDetailsTest() {
GetInvoiceDetailsResponse getInvoiceDetailsResponse = getInvoiceDetails
.getInvoiceDetails();
Assert.assertEquals(getInvoiceDetailsResponse.getResponseEnvelope()
.getAck().getValue().toString(), "Success");
}
@Test(groups = { "manual" })
public void sendInvoiceTest() {
SendInvoiceResponse sendInvoiceResponse = sendInvoice.sendInvoice();
Assert.assertEquals(sendInvoiceResponse.getResponseEnvelope().getAck()
.getValue().toString(), "Success");
}
@Test(groups = { "automate" })
public void searchInvoices() {
SearchInvoicesResponse searchInvoicesResponse = searchInvoices
.searchInvoices();
Assert.assertEquals(searchInvoicesResponse.getResponseEnvelope()
.getAck().getValue().toString(), "Success");
}
@BeforeClass(groups = { "automate", "manual" })
public void beforeClass() {
createInvoice = new CreateInvoice();
createAndSendInvoice = new CreateAndSendInvoice();
sendInvoice = new SendInvoice();
updateInvoice = new UpdateInvoice();
searchInvoices = new SearchInvoices();
getInvoiceDetails = new GetInvoiceDetails();
}
@AfterClass(groups = { "automate", "manual" })
public void afterClass() {
createInvoice = null;
createAndSendInvoice = null;
sendInvoice = null;
updateInvoice = null;
searchInvoices = null;
getInvoiceDetails = null;
}
}