Statistics
| Revision:

root / org.gvsig.proj / branches / refactor2018 / org.gvsig.proj / org.gvsig.proj.lib / org.gvsig.proj.lib.api / src / test / java / org / gvsig / proj / CoordinateReferenceSystemIT.java @ 805

History | View | Annotate | Download (2.62 KB)

1
/* gvSIG. Desktop Geographic Information System.
2
 *
3
 * Copyright ? 2007-2012 gvSIG Association
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program 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
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18
 * MA  02110-1301, USA.
19
 *
20
 * For any additional information, do not hesitate to contact us
21
 * at info AT gvsig.com, or visit our website www.gvsig.com.
22
 */
23
package org.gvsig.proj;
24

    
25
import org.gvsig.tools.junit.AbstractLibraryAutoInitTestCase;
26

    
27
/**
28
 * {@link CoordinateReferenceSystem} API acceptance tests.
29
 * 
30
 * @author gvSIG Team
31
 */
32
public abstract class CoordinateReferenceSystemIT extends
33
    AbstractLibraryAutoInitTestCase {
34

    
35
    protected CoordinateReferenceSystem projection;
36

    
37
    protected void doSetUp() throws Exception {
38
        projection = createProjection(getWKT());
39
    }
40

    
41
    /**
42
     * Creates a new {@link CoordinateReferenceSystem}.
43
     * 
44
     * @param code
45
     * @return the created projection
46
     * @throws CoordinateReferenceSystemNotFoundException
47
     */
48
    protected CoordinateReferenceSystem createProjection(
49
        String wkt) throws CoordinateReferenceSystemNotFoundException,
50
        Exception {
51
        return CoordinateReferenceSystemLocator.getManager().getCoordinateReferenceSystem(
52
                        wkt);
53
    }
54

    
55
    /**
56
     * Returns the code to use to create the projection to test.
57
     * 
58
     * @return the code
59
     */
60
    protected abstract String getWKT();
61

    
62
    /**
63
     * Test method for
64
     * {@link org.gvsig.proj.CoordinateReferenceSystem#getProjectedCode()}.
65
     * @throws Exception 
66
     * @throws UnsupportedOperationException 
67
     * @throws CoordinateReferenceSystemNotFoundException 
68
     */
69
    public void testCRSDeserialization() throws CoordinateReferenceSystemNotFoundException, UnsupportedOperationException, Exception {
70
        assertEquals(projection, createProjection(projection.getDefinition().toWKT()));
71
    }
72

    
73
    /**
74
     * Test method for
75
     * {@link org.gvsig.proj.CoordinateReferenceSystem#getDefinition()}.
76
     */
77
    public void testGetDefinition() {
78
        assertNotNull(projection.getDefinition());
79
    }
80

    
81
}