Debian Codegraph @

sejda-conversion/src/test/java/org/sejda/conversion/DimensionAdapterTest.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.Dimension;
24
25 import org.junit.Test;
26 import org.sejda.conversion.exception.ConversionException;
27
28 /**
29 * @author Andrea Vacondio
30 *
31 */
32 public class DimensionAdapterTest {
33 @Test
34 public void positives() {
35 assertEquals(new Dimension(100, 50), new DimensionAdapter("100x50").getDimension());
36 }
37
38 @Test(expected = ConversionException.class)
39 public void missing() {
40 new DimensionAdapter("10");
41 }
42
43 @Test(expected = ConversionException.class)
44 public void invalidX() {
45 new DimensionAdapter("Chuckx10");
46 }
47
48 @Test(expected = ConversionException.class)
49 public void invalidY() {
50 new DimensionAdapter("10xNorris");
51 }
52 }