1. Project Clover database Tue Dec 20 2016 21:24:09 CET
  2. Package com.xpn.xwiki.store

File DatabaseProductTest.java

 

Code metrics

0
23
3
1
70
36
3
0.13
7.67
3
1

Classes

Class Line # Actions
DatabaseProductTest 29 23 0% 3 0
1.0100%
 

Contributing tests

This file is covered by 3 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 com.xpn.xwiki.store;
21   
22    import junit.framework.TestCase;
23   
24    /**
25    * Unit tests for {@link DatabaseProduct}.
26    *
27    * @version $Id: 17e1d3a91e9387d03ef4eaa6c8cd02565bdb4aed $
28    */
 
29    public class DatabaseProductTest extends TestCase
30    {
 
31  1 toggle public void testEquality()
32    {
33  1 DatabaseProduct product = DatabaseProduct.toProduct("Oracle");
34  1 assertEquals(DatabaseProduct.ORACLE, product);
35  1 assertSame(DatabaseProduct.ORACLE, product);
36   
37  1 product = DatabaseProduct.toProduct("Apache Derby");
38  1 assertEquals(DatabaseProduct.DERBY, product);
39  1 assertSame(DatabaseProduct.DERBY, product);
40   
41  1 product = DatabaseProduct.toProduct("HSQL Database Engine");
42  1 assertEquals(DatabaseProduct.HSQLDB, product);
43  1 assertSame(DatabaseProduct.HSQLDB, product);
44   
45  1 product = DatabaseProduct.toProduct("DB2/LINUXX8664");
46  1 assertEquals(DatabaseProduct.DB2, product);
47  1 assertSame(DatabaseProduct.DB2, product);
48   
49  1 product = DatabaseProduct.toProduct("Unknown");
50  1 assertEquals(DatabaseProduct.UNKNOWN, product);
51  1 assertSame(DatabaseProduct.UNKNOWN, product);
52   
53  1 product = DatabaseProduct.toProduct("H2");
54  1 assertEquals(DatabaseProduct.H2, product);
55  1 assertSame(DatabaseProduct.H2, product);
56    }
57   
 
58  1 toggle public void testDifference()
59    {
60  1 DatabaseProduct product = DatabaseProduct.toProduct("Oracle");
61  1 assertTrue(product != DatabaseProduct.DERBY);
62  1 assertNotSame(DatabaseProduct.DERBY, product);
63    }
64   
 
65  1 toggle public void testUnknown()
66    {
67  1 DatabaseProduct product = DatabaseProduct.toProduct("whatever");
68  1 assertSame(DatabaseProduct.UNKNOWN, product);
69    }
70    }