1. Project Clover database Tue Dec 20 2016 21:24:09 CET
  2. Package org.xwiki.filter.type

File FilterStreamTypeTest.java

 

Code metrics

0
22
6
1
91
52
6
0.27
3.67
6
1

Classes

Class Line # Actions
FilterStreamTypeTest 30 22 0% 6 0
1.0100%
 

Contributing tests

This file is covered by 6 tests. .

Source view

1    /*
2    * See the NOTICE file distributed with this work for additional
3    * information regarding copyright ownership.
4    *
5    * This is free software; you can redistribute it and/or modify it
6    * under the terms of the GNU Lesser General Public License as
7    * published by the Free Software Foundation; either version 2.1 of
8    * the License, or (at your option) any later version.
9    *
10    * This software is distributed in the hope that it will be useful,
11    * but WITHOUT ANY WARRANTY; without even the implied warranty of
12    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13    * Lesser General Public License for more details.
14    *
15    * You should have received a copy of the GNU Lesser General Public
16    * License along with this software; if not, write to the Free
17    * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18    * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
19    */
20    package org.xwiki.filter.type;
21   
22    import org.junit.Assert;
23    import org.junit.Test;
24   
25    /**
26    * Validate {@link FilterStreamType}.
27    *
28    * @version $Id: f815073336ad5f44758f8e302d7c5c561017708c $
29    */
 
30    public class FilterStreamTypeTest
31    {
32    // Tests
33   
 
34  1 toggle @Test
35    public void testSerializeWithDataAndVersion()
36    {
37  1 FilterStreamType type = new FilterStreamType(new SystemType("type"), "data", "version");
38   
39  1 Assert.assertEquals("type+data/version", type.serialize());
40    }
41   
 
42  1 toggle @Test
43    public void testUnserializeWithDataAndVersion()
44    {
45  1 FilterStreamType type = FilterStreamType.unserialize("type+data/version");
46   
47  1 Assert.assertEquals("type", type.getType().getId());
48  1 Assert.assertEquals("data", type.getDataFormat());
49  1 Assert.assertEquals("version", type.getVersion());
50    }
51   
 
52  1 toggle @Test
53    public void testUnserializeWithData()
54    {
55  1 FilterStreamType type = FilterStreamType.unserialize("type+data");
56   
57  1 Assert.assertEquals("type", type.getType().getId());
58  1 Assert.assertEquals("data", type.getDataFormat());
59  1 Assert.assertNull(type.getVersion());
60    }
61   
 
62  1 toggle @Test
63    public void testUnserializeWithEmptyData()
64    {
65  1 FilterStreamType type = FilterStreamType.unserialize("type+");
66   
67  1 Assert.assertEquals("type", type.getType().getId());
68  1 Assert.assertEquals("", type.getDataFormat());
69  1 Assert.assertNull(type.getVersion());
70    }
71   
 
72  1 toggle @Test
73    public void testUnserializeWithVersion()
74    {
75  1 FilterStreamType type = FilterStreamType.unserialize("type/version");
76   
77  1 Assert.assertEquals("type", type.getType().getId());
78  1 Assert.assertNull(type.getDataFormat());
79  1 Assert.assertEquals("version", type.getVersion());
80    }
81   
 
82  1 toggle @Test
83    public void testUnserializeWithEmptyVersion()
84    {
85  1 FilterStreamType type = FilterStreamType.unserialize("type/");
86   
87  1 Assert.assertEquals("type", type.getType().getId());
88  1 Assert.assertNull(type.getDataFormat());
89  1 Assert.assertEquals("", type.getVersion());
90    }
91    }