|
| 1 | +/* |
| 2 | + This file is part of the iText (R) project. |
| 3 | + Copyright (c) 1998-2025 Apryse Group NV |
| 4 | + Authors: Apryse Software. |
| 5 | +
|
| 6 | + This program is offered under a commercial and under the AGPL license. |
| 7 | + For commercial licensing, contact us at https://itextpdf.com/sales. For AGPL licensing, see below. |
| 8 | +
|
| 9 | + AGPL licensing: |
| 10 | + This program is free software: you can redistribute it and/or modify |
| 11 | + it under the terms of the GNU Affero General Public License as published by |
| 12 | + the Free Software Foundation, either version 3 of the License, or |
| 13 | + (at your option) any later version. |
| 14 | +
|
| 15 | + This program is distributed in the hope that it will be useful, |
| 16 | + but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 17 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 18 | + GNU Affero General Public License for more details. |
| 19 | +
|
| 20 | + You should have received a copy of the GNU Affero General Public License |
| 21 | + along with this program. If not, see <https://www.gnu.org/licenses/>. |
| 22 | + */ |
| 23 | +package com.itextpdf.pdfocr.onnxtr.util; |
| 24 | + |
| 25 | +import com.itextpdf.test.ExtendedITextTest; |
| 26 | +import org.junit.jupiter.api.Assertions; |
| 27 | +import org.junit.jupiter.api.Tag; |
| 28 | +import org.junit.jupiter.params.ParameterizedTest; |
| 29 | +import org.junit.jupiter.params.provider.MethodSource; |
| 30 | + |
| 31 | +import java.util.Arrays; |
| 32 | + |
| 33 | +@Tag("UnitTest") |
| 34 | +public class Dimensions2DUnitTest extends ExtendedITextTest { |
| 35 | + |
| 36 | + public static Iterable<Object[]> equalsFalse() { |
| 37 | + return Arrays.asList(new Object[][]{ |
| 38 | + {new Dimensions2D(100, 20), null}, |
| 39 | + {new Dimensions2D(100, 20), "different class"}, |
| 40 | + {new Dimensions2D(100, 700), new Dimensions2D(100, 800)}, |
| 41 | + {new Dimensions2D(100, 800), new Dimensions2D(200, 800)}, |
| 42 | + {new Dimensions2D(100, 700), new Dimensions2D(200, 800)}, |
| 43 | + }); |
| 44 | + } |
| 45 | + |
| 46 | + public static Iterable<Object[]> equalsTrue() { |
| 47 | + Dimensions2D dimensions2D = new Dimensions2D(100, 200); |
| 48 | + return Arrays.asList(new Object[][]{ |
| 49 | + {dimensions2D, new Dimensions2D(100, 200)}, |
| 50 | + {dimensions2D, dimensions2D}, |
| 51 | + }); |
| 52 | + } |
| 53 | + |
| 54 | + @ParameterizedTest(name = "first: {0}, second: {1}") |
| 55 | + @MethodSource("equalsFalse") |
| 56 | + public void equalsNegativeTest(Dimensions2D first, Object second) { |
| 57 | + Assertions.assertNotEquals(first, second); |
| 58 | + } |
| 59 | + |
| 60 | + @ParameterizedTest(name = "first: {0}, second: {1}") |
| 61 | + @MethodSource("equalsTrue") |
| 62 | + public void equalsPositiveTest(Dimensions2D first, Dimensions2D second) { |
| 63 | + Assertions.assertEquals(first, second); |
| 64 | + } |
| 65 | +} |
0 commit comments