Statistics
| Revision:

svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.library / org.gvsig.installer / org.gvsig.installer.lib / org.gvsig.installer.lib.impl / src / test / java / org / gvsig / installer / lib / impl / VersionTest.java @ 40560

History | View | Annotate | Download (1.89 KB)

1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright (C) 2007-2013 gvSIG Association.
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 3
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
23
 */
24
package org.gvsig.installer.lib.impl;
25

    
26
import junit.framework.TestCase;
27

    
28
import org.gvsig.installer.lib.api.Version;
29

    
30
public class VersionTest extends TestCase {
31

    
32
        public void testParseVersion() {
33
                Version v = new DefaultVersion();
34

    
35
                v.parse("2.3.20-SNAPSHOT-10");
36
                assertEquals("0002.0003.0020-SNAPSHOT-0010", v.fullFormat());
37

    
38
                v.parse("2.3.20-SNAPSHOT");
39
                assertEquals("0002.0003.0020-SNAPSHOT-0000", v.fullFormat());
40

    
41
                v.parse("2.3.20-10");
42
                assertEquals("0002.0003.0020-ZZZZ-0010", v.fullFormat());
43

    
44
                v.parse("2.3.20");
45
                assertEquals("0002.0003.0020-ZZZZ-0000", v.fullFormat());
46

    
47
                v.parse("2.3");
48
                assertEquals("0002.0003.0000-ZZZZ-0000", v.fullFormat());
49

    
50
                v.parse("2");
51
                assertEquals("0002.0000.0000-ZZZZ-0000", v.fullFormat());
52
        }
53

    
54
        public void testCompareVersion() {
55
                Version v1 = new DefaultVersion();
56
                Version v2 = new DefaultVersion();
57

    
58
                v1.parse("2.3.20-SNAPSHOT-10");
59
                v2.parse("2.3");
60
                boolean b = v2.check(">=", v1);
61
                assert (b);
62

    
63
        }
64
}