Seth před 7 roky
rodič
revize
656eab0910

+ 37
- 0
src/main/java/com/zipcoder/payment/PayPal.java Zobrazit soubor

@@ -0,0 +1,37 @@
1
+package com.zipcoder.payment;
2
+
3
+public class PayPal {
4
+    long id;
5
+    String payerName;
6
+    String email;
7
+
8
+    public PayPal(long id, String payerName, String email) {
9
+        this.id = id;
10
+        this.payerName = payerName;
11
+        this.email = email;
12
+    }
13
+
14
+    public long getId() {
15
+        return id;
16
+    }
17
+
18
+    public void setId(long id) {
19
+        this.id = id;
20
+    }
21
+
22
+    public String getPayerName() {
23
+        return payerName;
24
+    }
25
+
26
+    public void setPayerName(String payerName) {
27
+        this.payerName = payerName;
28
+    }
29
+
30
+    public String getEmail() {
31
+        return email;
32
+    }
33
+
34
+    public void setEmail(String email) {
35
+        this.email = email;
36
+    }
37
+}

+ 45
- 0
src/test/java/com/zipcoder/payment/PayPalTest.java Zobrazit soubor

@@ -0,0 +1,45 @@
1
+package com.zipcoder.payment;
2
+
3
+import org.junit.Assert;
4
+import org.junit.Before;
5
+import org.junit.Test;
6
+
7
+public class PayPalTest {
8
+    PayPal testPal;
9
+
10
+
11
+    @Before
12
+    public void initialization() {
13
+        testPal = new PayPal(15,"Momo Hashimoto", "kawaii54@line.com");
14
+
15
+    }
16
+    @Test
17
+    public void getSetIdTest() {
18
+        long expected = 100;
19
+        testPal.setId(100);
20
+        long actual = testPal.getId();
21
+
22
+        Assert.assertEquals(expected, actual);
23
+
24
+    }
25
+
26
+    @Test
27
+    public void getSetPayerNameTest() {
28
+        String expected = "Sara";
29
+        testPal.setPayerName("Sara");
30
+
31
+        String actual = testPal.getPayerName();
32
+
33
+        Assert.assertEquals(expected, actual);
34
+    }
35
+
36
+    @Test
37
+    public void getSetEmail() {
38
+        String expected = "godot@gmail.com";
39
+        testPal.setEmail("godot@gmail.com");
40
+
41
+        String actual = testPal.getEmail();
42
+
43
+        Assert.assertEquals(expected, actual);
44
+    }
45
+}