-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathCallableValueTest.java
71 lines (59 loc) · 1.92 KB
/
CallableValueTest.java
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
package edu.abhi.poi.excel;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.Future;
import org.junit.Before;
import org.junit.Test;
public class CallableValueTest {
private CallableValue callableValue;
@Before
public void setup(){
callableValue = new CallableValue();
}
@Test
public void setExceptionTest(){
Exception exception=new RuntimeException("Test Message");
callableValue.setException(exception);
assertEquals(exception,callableValue.getException());
}
@Test
public void AnalyzeResultWithEmptyList(){
List<Future<CallableValue>> futures = new ArrayList<>();
assertFalse(CallableValue.analyzeResult(futures));
}
@Test
public void setFailedTrueTest(){
callableValue.setFailed(true);
assertTrue(callableValue.isFailed());
}
@Test
public void setFailedFalseTest(){
callableValue.setFailed(false);
assertFalse(callableValue.isFailed());
}
@Test
public void getDiffContainerWithContentTest(){
String differenceContent="Test difference";
callableValue.getDiffContainer().append(differenceContent);
assertEquals(differenceContent,callableValue.getDiffContainer().toString());
}
@Test
public void getDiffContainerWithoutContentTest(){
StringBuilder testStringBuilder=callableValue.getDiffContainer();
assertTrue(testStringBuilder.isEmpty());
}
@Test
public void setDiffFlagFalseTest(){
callableValue.setDiffFlag(false);
assertFalse(callableValue.isDiffFlag());
}
@Test
public void setDiffFlagTrueTest(){
callableValue.setDiffFlag(true);
assertTrue(callableValue.isDiffFlag());
}
}