1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package org.xwiki.properties.internal.converter; |
21 |
|
|
22 |
|
import java.io.IOException; |
23 |
|
import java.io.InputStream; |
24 |
|
import java.util.Arrays; |
25 |
|
|
26 |
|
import org.apache.commons.io.IOUtils; |
27 |
|
import org.junit.Assert; |
28 |
|
import org.junit.Before; |
29 |
|
import org.junit.Test; |
30 |
|
import org.xwiki.properties.ConverterManager; |
31 |
|
import org.xwiki.test.jmock.AbstractComponentTestCase; |
32 |
|
|
33 |
|
|
34 |
|
@link |
35 |
|
|
36 |
|
@version |
37 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (7) |
Complexity: 3 |
Complexity Density: 0.75 |
|
38 |
|
public class InputStreamConverterTest extends AbstractComponentTestCase |
39 |
|
{ |
40 |
|
private ConverterManager converterManager; |
41 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
42 |
2 |
@Before... |
43 |
|
@Override |
44 |
|
public void setUp() throws Exception |
45 |
|
{ |
46 |
2 |
super.setUp(); |
47 |
|
|
48 |
2 |
this.converterManager = getComponentManager().getInstance(ConverterManager.class); |
49 |
|
} |
50 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
1PASS
|
|
51 |
1 |
@Test... |
52 |
|
public void testFromString() throws IOException |
53 |
|
{ |
54 |
1 |
Assert.assertTrue(Arrays.equals(new byte[] { 1, 2, 3, 4, 5, 6, 7, 8, 9 }, |
55 |
|
IOUtils.toByteArray(this.converterManager.<InputStream>convert(InputStream.class, "1,2,3,4,5,6,7,8,9")))); |
56 |
|
} |
57 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
1PASS
|
|
58 |
1 |
@Test... |
59 |
|
public void testConvertNull() |
60 |
|
{ |
61 |
1 |
Assert.assertNull(this.converterManager.convert(InputStream.class, null)); |
62 |
|
} |
63 |
|
} |