Skip to content

Commit 4980327

Browse files
author
Thomas Fung
committed
added test for CvcVerification
1 parent 1915cc8 commit 4980327

File tree

1 file changed

+74
-0
lines changed

1 file changed

+74
-0
lines changed
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
/*******************************************************************************
2+
* Copyright (c) 2019 Intuit
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*******************************************************************************/
16+
package com.intuit.payment.data;
17+
18+
import org.apache.commons.lang.builder.ReflectionToStringBuilder;
19+
import org.testng.Assert;
20+
import org.testng.annotations.BeforeMethod;
21+
import org.testng.annotations.BeforeTest;
22+
import org.testng.annotations.Test;
23+
24+
import java.util.Date;
25+
26+
/**
27+
* @author tfung
28+
*/
29+
public class CvcVerificationTest {
30+
31+
private String result;
32+
private Date date;
33+
34+
private CvcVerification cvcVerification;
35+
36+
@BeforeTest
37+
public void init() {
38+
this.result = "result";
39+
this.date = new Date(01/31/2019);
40+
}
41+
42+
@BeforeMethod
43+
public void setUp() {
44+
cvcVerification = new CvcVerification.Builder()
45+
.result(result)
46+
.date(date)
47+
.build();
48+
}
49+
50+
@Test
51+
public void testAllGetters() {
52+
Assert.assertEquals(cvcVerification.getResult(), result);
53+
Assert.assertEquals(cvcVerification.getDate(), date);
54+
}
55+
56+
@Test
57+
public void testAllSetters() {
58+
String newResult = "new result";
59+
Date newDate = new Date(02/28/2019);
60+
61+
cvcVerification.setResult(newResult);
62+
cvcVerification.setDate(newDate);
63+
64+
Assert.assertEquals(cvcVerification.getResult(), newResult);
65+
Assert.assertEquals(cvcVerification.getDate(), newDate);
66+
}
67+
68+
@Test
69+
public void testToString() {
70+
String expectedResult = ReflectionToStringBuilder.toString(cvcVerification);
71+
String actualResult = cvcVerification.toString();
72+
Assert.assertTrue(actualResult.contains(expectedResult));
73+
}
74+
}

0 commit comments

Comments
 (0)