Debian Codegraph @

sejda-conversion/src/test/java/org/sejda/conversion/PointAdatperTest.java

raw
1 /*
2 * Created on 22 ott 2016
3 * Copyright 2015 by Andrea Vacondio ([email protected]).
4 * This file is part of Sejda.
5 *
6 * Sejda is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU Affero General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * Sejda 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 Affero General Public License for more details.
15 *
16 * You should have received a copy of the GNU Affero General Public License
17 * along with Sejda. If not, see <http://www.gnu.org/licenses/>.
18 */
19 package org.sejda.conversion;
20
21 import static org.junit.Assert.assertEquals;
22
23 import java.awt.Point;
24
25 import org.junit.Test;
26 import org.sejda.conversion.exception.ConversionException;
27
28 /**
29 * @author Andrea Vacondio
30 *
31 */
32 public class PointAdatperTest {
33 @Test
34 public void positives() {
35 assertEquals(new Point(10, 50), new PointAdatper("10,50").getPoint());
36 assertEquals(new Point(-10, -550), new PointAdatper("-10,-550").getPoint());
37 }
38
39 @Test(expected = ConversionException.class)
40 public void missingCoordinate() {
41 new PointAdatper("10");
42 }
43
44 @Test(expected = ConversionException.class)
45 public void invalidX() {
46 new PointAdatper("Chuck,10");
47 }
48
49 @Test(expected = ConversionException.class)
50 public void invalidY() {
51 new PointAdatper("10,Norris");
52 }
53 }