Clover Coverage Report - EasyMock 3.0
Coverage timestamp: sam. mai 8 2010 14:37:27 CEST
14   84   10   1,4
0   51   0,71   10
10     1  
1    
 
  ArgumentToStringTest       Line # 28 14 0% 10 0 100% 1.0
 
  (16)
 
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.ArgumentToString;
22    import org.junit.Before;
23    import org.junit.Test;
24   
25    /**
26    * @author Henri Tremblay
27    */
 
28    public class ArgumentToStringTest {
29   
30    private StringBuffer buffer;
31   
 
32  16 toggle @Before
33    public void setUp() {
34  16 buffer = new StringBuffer();
35    }
36   
 
37  2 toggle @Test
38    public void testAppendArgument_null() {
39  2 assertString("null", null);
40    }
41   
 
42  2 toggle @Test
43    public void testAppendArgument_String() {
44  2 assertString("\"hello\"", "hello");
45    }
46   
 
47  2 toggle @Test
48    public void testAppendArgument_Character() {
49  2 assertString("'c'", Character.valueOf('c'));
50    }
51   
 
52  2 toggle @Test
53    public void testAppendArgument_Array() {
54  2 assertString("[\"a\", \"b\"]", new String[] { "a", "b" });
55    }
56   
 
57  2 toggle @Test
58    public void testAppendArgument_Full() {
59  2 assertString("[3, 4, [\"a\", \"b\"], null]", new Object[] { 3, 4, new String[] { "a", "b" }, null });
60    }
61   
 
62  10 toggle private void assertString(final String expected, final Object actual) {
63  10 ArgumentToString.appendArgument(actual, buffer);
64  10 assertEquals(expected, buffer.toString());
65    }
66   
 
67  2 toggle @Test
68    public void testArgumentToString() {
69  2 final String actual = ArgumentToString.argumentToString(Boolean.TRUE);
70  2 assertEquals(Boolean.TRUE.toString(), actual);
71    }
72   
 
73  2 toggle @Test
74    public void testArgumentsToString() {
75  2 final String actual = ArgumentToString.argumentsToString(Boolean.TRUE, Boolean.FALSE);
76  2 assertEquals("true, false", actual);
77    }
78   
 
79  2 toggle @Test
80    public void testArgumentsToString_null() {
81  2 final String actual = ArgumentToString.argumentsToString((Object[]) null);
82  2 assertEquals("", actual);
83    }
84    }