This repository was archived by the owner on Oct 15, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 30
Expand file tree
/
Copy pathTransferRequestTest.java
More file actions
61 lines (53 loc) · 2.41 KB
/
TransferRequestTest.java
File metadata and controls
61 lines (53 loc) · 2.41 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
package br.com.moip.request;
import br.com.moip.util.GsonFactory;
import com.google.gson.JsonObject;
import org.json.JSONException;
import org.junit.Test;
import org.skyscreamer.jsonassert.JSONAssert;
public class TransferRequestTest extends RequestTest{
@Test
public void testCreateTransfer() throws JSONException {
TransferRequest transfer = new TransferRequest()
.amount(500)
.transferInstrument(new TransferInstrumentRequest()
.bankAccount(new BankAccountRequest()
.bankNumber("001")
.agencyNumber("1111")
.agencyCheckNumber("2")
.accountNumber("9999")
.accountCheckNumber("8")
.checking()
.holder(new HolderRequest()
.fullname("Nome do Portador")
.taxDocument(TaxDocumentRequest.cpf("22222222222"))
)
)
);
String json = new GsonFactory().gson().toJson(transfer);
JsonObject expectedJSON = getJsonFileAsJsonObject("transfer/create.json");
JSONAssert.assertEquals(expectedJSON.toString(), json, true);
}
@Test
public void testCreateTransferWithDescription() throws JSONException {
TransferRequest transfer = new TransferRequest()
.amount(500)
.description("This is a description for a transfer.")
.transferInstrument(new TransferInstrumentRequest()
.bankAccount(new BankAccountRequest()
.bankNumber("001")
.agencyNumber("1111")
.agencyCheckNumber("2")
.accountNumber("9999")
.accountCheckNumber("8")
.checking()
.holder(new HolderRequest()
.fullname("Nome do Portador")
.taxDocument(TaxDocumentRequest.cpf("22222222222"))
)
)
);
String json = new GsonFactory().gson().toJson(transfer);
JsonObject expectedJSON = getJsonFileAsJsonObject("transfer/createWithDescription.json");
JSONAssert.assertEquals(expectedJSON.toString(), json, true);
}
}