Skip to content

Commit 5960f98

Browse files
committed
100% line coverage for CheckContext
1 parent c8f0fcb commit 5960f98

File tree

1 file changed

+68
-0
lines changed

1 file changed

+68
-0
lines changed
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
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+
/**
25+
* @author harry0123
26+
*/
27+
public class CheckContextTest {
28+
29+
private DeviceInfo deviceInfo;
30+
31+
private CheckContext checkContext;
32+
33+
@BeforeTest
34+
public void init() {
35+
deviceInfo = new DeviceInfo();
36+
}
37+
38+
@BeforeMethod
39+
public void setUpWith() {
40+
checkContext = new CheckContext.Builder(deviceInfo).build();
41+
}
42+
43+
@Test
44+
public void testConstructor() {
45+
CheckContext newCheckContext = new CheckContext();
46+
Assert.assertNotNull(newCheckContext);
47+
}
48+
49+
@Test
50+
public void testAllGetters() {
51+
Assert.assertEquals(checkContext.getDeviceInfo(), deviceInfo);
52+
}
53+
54+
@Test
55+
public void testAllSetters() {
56+
DeviceInfo newDeviceInfo = new DeviceInfo();
57+
checkContext.setDeviceInfo(newDeviceInfo);
58+
59+
Assert.assertEquals(checkContext.getDeviceInfo(), newDeviceInfo);
60+
}
61+
62+
@Test
63+
public void testToString() {
64+
String expectedResult = ReflectionToStringBuilder.toString(checkContext);
65+
String actualResult = checkContext.toString();
66+
Assert.assertTrue(actualResult.contains(expectedResult));
67+
}
68+
}

0 commit comments

Comments
 (0)