|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
ResultTest | Line # 29 | 12 | 0% | 4 | 0 | 100% |
1.0
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
(8) | |||
Result | |||
0.25
|
org.easymock.tests.ResultTest.createReturnResultToString
![]() |
1 PASS | |
0.25
|
org.easymock.tests.ResultTest.createDelegateResultToString
![]() |
1 PASS | |
0.25
|
org.easymock.tests.ResultTest.createReturnResultToString
![]() |
1 PASS | |
0.25
|
org.easymock.tests.ResultTest.createDelegateResultToString
![]() |
1 PASS | |
0.25
|
org.easymock.tests.ResultTest.emptyResults
![]() |
1 PASS | |
0.25
|
org.easymock.tests.ResultTest.emptyResults
![]() |
1 PASS | |
0.25
|
org.easymock.tests.ResultTest.createThrowResultToString
![]() |
1 PASS | |
0.25
|
org.easymock.tests.ResultTest.createThrowResultToString
![]() |
1 PASS | |
1 | /** | |
2 | * Copyright 2001-2010 the original author or authors. | |
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 | ||
17 | package org.easymock.tests; | |
18 | ||
19 | import static org.junit.Assert.*; | |
20 | ||
21 | import org.easymock.internal.Result; | |
22 | import org.easymock.internal.Results; | |
23 | import org.junit.Test; | |
24 | ||
25 | /** | |
26 | * @author OFFIS, Tammo Freese | |
27 | * @author Henri Tremblay | |
28 | */ | |
29 | public class ResultTest { | |
30 | ||
31 | 2 |
![]() |
32 | public void createThrowResultToString() { | |
33 | 2 | final Exception e = new Exception("Error message"); |
34 | 2 | final Result r = Result.createThrowResult(e); |
35 | 2 | assertEquals("Answer throwing " + e, r.toString()); |
36 | } | |
37 | ||
38 | 2 |
![]() |
39 | public void createReturnResultToString() { | |
40 | 2 | final String value = "My value"; |
41 | 2 | final Result r = Result.createReturnResult(value); |
42 | 2 | assertEquals("Answer returning " + value, r.toString()); |
43 | } | |
44 | ||
45 | 2 |
![]() |
46 | public void createDelegateResultToString() { | |
47 | 2 | final String value = "my value"; |
48 | 2 | final Result r = Result.createDelegatingResult(value); |
49 | 2 | assertEquals("Delegated to " + value, r.toString()); |
50 | } | |
51 | ||
52 | 2 |
![]() |
53 | public void emptyResults() { | |
54 | // We never create a Results without at least one Range | |
55 | // This test is only to unit test Results with this to cover the case anyway | |
56 | 2 | final Results results = new Results(); |
57 | 2 | assertFalse(results.hasResults()); |
58 | 2 | assertNull(results.next()); |
59 | } | |
60 | } |
|