libs.javaee-web-api-7.0.displayName=Java EE Web 7 API Library
libs.javaee-web-api-7.0.javadoc=
libs.javaee-web-api-7.0.prop-maven-dependencies=javax:javaee-web-api:7.0:jar
+libs.testng.classpath=\
+ ${base}/testng/testng-6.8.1-dist.jar
+libs.testng.displayName=TestNG 6.8.1
+libs.testng.prop-maven-dependencies=org.testng:testng:6.8.1:jar
javac.target=1.7
javac.test.classpath=\
${javac.classpath}:\
- ${build.classes.dir}
+ ${build.classes.dir}:\
+ ${libs.testng.classpath}
javac.test.processorpath=\
${javac.test.classpath}
javadoc.additionalparam=
+++ /dev/null
-/*
- * Copyright (C) 2022 Free Software Foundation
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.jcoreutils;
-
-import java.io.Serializable;
-
-/**
- * An utilities class for comparison of objects/entities
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- */
-public class Comparables implements Serializable {
-
- /**
- * Serial number
- */
- private static final long serialVersionUID = 19_286_457_671_390L;
-
- /**
- * Checks all comparison values if they are not zero and returns proper
- * value. These comparators should come from an implementation of
- * Comparable.compareTo().
- * <p>
- * @param comparators An array of at least one comparator
- * <p>
- * @return Comparison value
- */
- public static int checkAll (final int[] comparators) {
- // Is array empty?
- if (comparators.length == 0) {
- // Should not happen
- throw new IllegalArgumentException("comparators is empty."); //NOI18N
- }
-
- // Loop through all
- for (int i = 0; i < comparators.length; i++) {
- // Is it smaller or bigger?
- if (comparators[i] < 0) {
- return -1;
- } else if (comparators[i] > 0) {
- return 1;
- }
- }
-
- // Assume equality
- return 0;
- }
-
- /**
- * Utility classes should not have instances
- */
- private Comparables () {
- }
-
-}
+++ /dev/null
-/*
- * Copyright (C) 2022 Free Software Foundation
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.jcoreutils;
-
-import java.io.Serializable;
-import java.math.BigDecimal;
-import java.util.Objects;
-
-/**
- * Null-safe utilities class for numbers
- * <p>
- * @author Roland Häder<roland@mxchange.org>
- */
-public class SafeNumberUtils implements Serializable {
-
- /**
- * Serial number
- */
- private static final long serialVersionUID = 153_746_766_826_120L;
-
- /**
- * Compares both Integer instances null-safe following the rules of
- * Comparable.compareTo().
- * <p>
- * @param integer1 Integer instance 1
- * @param integer2 Integer instance 2
- * <p>
- * @return Comparison value
- */
- public static int compare (final Integer integer1, final Integer integer2) {
- // Check instances
- if (Objects.equals(integer1, integer2)) {
- // Both objects are equal
- return 0;
- } else if (null == integer1) {
- // First number is null (means is smaller than 0)
- return -1;
- } else if (null == integer2) {
- // Second number is null (means is bigger than 0)
- return 1;
- }
-
- // Compare vaules null-safe
- return Integer.compare(integer1, integer2);
- }
-
- /**
- * Compares both Long instances null-safe following the rules of
- * Comparable.compareTo().
- * <p>
- * @param long1 Long instance 1
- * @param long2 Long instance 2
- * <p>
- * @return Comparison value
- */
- public static int compare (final Long long1, final Long long2) {
- // Check instances
- if (Objects.equals(long1, long2)) {
- // Both objects are equal
- return 0;
- } else if (null == long1) {
- // First number is null (means is smaller than 0)
- return -1;
- } else if (null == long2) {
- // Second number is null (means is smaller than 0)
- return 1;
- }
-
- // Compare vaules null-safe
- return Long.compare(long1, long2);
- }
-
- /**
- * Compares both Short instances null-safe following the rules of
- * Comparable.compareTo().
- * <p>
- * @param short1 Short instance 1
- * @param short2 Short instance 2
- * <p>
- * @return Comparison value
- */
- public static int compare (final Short short1, final Short short2) {
- // Check instances
- if (Objects.equals(short1, short2)) {
- // Both objects are equal
- return 0;
- } else if (null == short1) {
- // First number is null (means is smaller than 0)
- return -1;
- } else if (null == short2) {
- // Second number is null (means is smaller than 0)
- return 1;
- }
-
- // Compare vaules null-safe
- return Short.compare(short1, short2);
- }
-
- /**
- * Compares both BigDecimal instances null-safe following the rules of
- * Comparable.compareTo().
- * <p>
- * @param decimal1 BigDecimal instance 1
- * @param decimal2 BigDecimal instance 2
- * <p>
- * @return Comparison value
- */
- public static int compare (final BigDecimal decimal1, final BigDecimal decimal2) {
- // Check instances
- if (Objects.equals(decimal1, decimal2)) {
- // Both objects are equal
- return 0;
- } else if (null == decimal1) {
- // First number is null (means is smaller than 0)
- return -1;
- } else if (null == decimal2) {
- // Second number is null (means is smaller than 0)
- return 1;
- }
-
- // Compare vaules null-safe
- return decimal1.compareTo(decimal2);
- }
-
- /**
- * Utilities classes should not have instances
- */
- private SafeNumberUtils () {
- // Private constructor
- }
-
-}
--- /dev/null
+/*
+ * Copyright (C) 2022 Free Software Foundation
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jcoreutils.comparable;
+
+import java.io.Serializable;
+
+/**
+ * An utilities class for comparison of objects/entities
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+public class Comparables implements Serializable {
+
+ /**
+ * Serial number
+ */
+ private static final long serialVersionUID = 19_286_457_671_390L;
+
+ /**
+ * Checks all comparison values if they are not zero and returns proper
+ * value. These comparators should come from an implementation of
+ * Comparable.compareTo().
+ * <p>
+ * @param comparators An array of at least one comparator
+ * <p>
+ * @return Comparison value
+ */
+ public static int checkAll (final int[] comparators) {
+ // Is array empty?
+ if (comparators.length == 0) {
+ // Should not happen
+ throw new IllegalArgumentException("comparators is empty."); //NOI18N
+ }
+
+ // Loop through all
+ for (int i = 0; i < comparators.length; i++) {
+ // Is it smaller or bigger?
+ if (comparators[i] < 0) {
+ return -1;
+ } else if (comparators[i] > 0) {
+ return 1;
+ }
+ }
+
+ // Assume equality
+ return 0;
+ }
+
+ /**
+ * Utility classes should not have instances
+ */
+ private Comparables () {
+ }
+
+}
--- /dev/null
+/*
+ * Copyright (C) 2022 Free Software Foundation
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jcoreutils.number;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.Objects;
+
+/**
+ * Null-safe utilities class for numbers
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+public class SafeNumberUtils implements Serializable {
+
+ /**
+ * Serial number
+ */
+ private static final long serialVersionUID = 153_746_766_826_120L;
+
+ /**
+ * Compares both Integer instances null-safe following the rules of
+ * Comparable.compareTo().
+ * <p>
+ * @param integer1 Integer instance 1
+ * @param integer2 Integer instance 2
+ * <p>
+ * @return Comparison value
+ */
+ public static int compare (final Integer integer1, final Integer integer2) {
+ // Check instances
+ if (Objects.equals(integer1, integer2)) {
+ // Both objects are equal
+ return 0;
+ } else if (null == integer1) {
+ // First number is null (means is smaller than 0)
+ return -1;
+ } else if (null == integer2) {
+ // Second number is null (means is bigger than 0)
+ return 1;
+ }
+
+ // Compare vaules null-safe
+ return Integer.compare(integer1, integer2);
+ }
+
+ /**
+ * Compares both Long instances null-safe following the rules of
+ * Comparable.compareTo().
+ * <p>
+ * @param long1 Long instance 1
+ * @param long2 Long instance 2
+ * <p>
+ * @return Comparison value
+ */
+ public static int compare (final Long long1, final Long long2) {
+ // Check instances
+ if (Objects.equals(long1, long2)) {
+ // Both objects are equal
+ return 0;
+ } else if (null == long1) {
+ // First number is null (means is smaller than 0)
+ return -1;
+ } else if (null == long2) {
+ // Second number is null (means is smaller than 0)
+ return 1;
+ }
+
+ // Compare vaules null-safe
+ return Long.compare(long1, long2);
+ }
+
+ /**
+ * Compares both Short instances null-safe following the rules of
+ * Comparable.compareTo().
+ * <p>
+ * @param short1 Short instance 1
+ * @param short2 Short instance 2
+ * <p>
+ * @return Comparison value
+ */
+ public static int compare (final Short short1, final Short short2) {
+ // Check instances
+ if (Objects.equals(short1, short2)) {
+ // Both objects are equal
+ return 0;
+ } else if (null == short1) {
+ // First number is null (means is smaller than 0)
+ return -1;
+ } else if (null == short2) {
+ // Second number is null (means is smaller than 0)
+ return 1;
+ }
+
+ // Compare vaules null-safe
+ return Short.compare(short1, short2);
+ }
+
+ /**
+ * Compares both BigDecimal instances null-safe following the rules of
+ * Comparable.compareTo().
+ * <p>
+ * @param decimal1 BigDecimal instance 1
+ * @param decimal2 BigDecimal instance 2
+ * <p>
+ * @return Comparison value
+ */
+ public static int compare (final BigDecimal decimal1, final BigDecimal decimal2) {
+ // Check instances
+ if (Objects.equals(decimal1, decimal2)) {
+ // Both objects are equal
+ return 0;
+ } else if (null == decimal1) {
+ // First number is null (means is smaller than 0)
+ return -1;
+ } else if (null == decimal2) {
+ // Second number is null (means is smaller than 0)
+ return 1;
+ }
+
+ // Compare vaules null-safe
+ return decimal1.compareTo(decimal2);
+ }
+
+ /**
+ * Utilities classes should not have instances
+ */
+ private SafeNumberUtils () {
+ // Private constructor
+ }
+
+}
--- /dev/null
+<?xml version='1.0' encoding='UTF-8' ?>
+<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
+<suite name="jcore-utils">
+ <!--
+ see examples at http://testng.org/doc/documentation-main.html#testng-xml
+
+ <suite-files>
+ <suite-file path="./junit-suite.xml" />
+ </suite-files>
+
+ <test name="TimeOut">
+ <classes>
+ <class name="test.timeout.TimeOutTest" />
+ <class name="test.timeout.TimeOutFromXmlTest"/>
+ <class name="test.timeout.TimeOutThreadLocalSampleTest"/>
+ </classes>
+ </test>
+ -->
+ <test name="org.mxchange.jcoreutils.test suite">
+ <packages>
+ <package name="org.mxchange.jcoreutils.test"/>
+ </packages>
+ </test>
+</suite>
--- /dev/null
+/*
+ * Copyright (C) 2022 Roland Häder<roland@mxchange.org>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.jcoreutils.test.number;
+
+import java.math.BigDecimal;
+import org.mxchange.jcoreutils.number.SafeNumberUtils;
+import org.testng.Assert;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+/**
+ * Tests methods in SafeNumberUtils class
+ * <p>
+ * @author Roland Häder<roland@mxchange.org>
+ */
+public class SafeNumberUtilsTest {
+
+ private static final short SHORT1 = 1;
+
+ private static final short SHORT2 = 2;
+
+ private static final short SHORT3 = 3;
+
+ private static final short SHORT4 = 4;
+
+ /**
+ * Default constructor
+ */
+ public SafeNumberUtilsTest () {
+ }
+
+ @DataProvider (name = "bigdecimal-larger-numbers-provider")
+ public Object[][] createLargerBigDecimal () {
+ return new Object[][]{
+ {new BigDecimal(1), new BigDecimal(2)},
+ {new BigDecimal(2), new BigDecimal(3)},
+ {new BigDecimal(3), new BigDecimal(4)}
+ };
+ }
+
+ @DataProvider (name = "int-larger-numbers-provider")
+ public Object[][] createLargerInteger () {
+ return new Object[][]{
+ {1, 2},
+ {2, 3},
+ {3, 4}
+ };
+ }
+
+ @DataProvider (name = "long-larger-numbers-provider")
+ public Object[][] createLargerLong () {
+ return new Object[][]{
+ {1L, 2L},
+ {2L, 3L},
+ {3L, 4L}
+ };
+ }
+
+ @DataProvider (name = "short-larger-numbers-provider")
+ public Object[][] createLargerShort () {
+ return new Object[][]{
+ {SHORT1, SHORT2},
+ {SHORT2, SHORT3},
+ {SHORT3, SHORT4}
+ };
+ }
+
+ @DataProvider (name = "bigdecimal-left-null-numbers-provider")
+ public Object[][] createLeftNullBigDecimal () {
+ return new Object[][]{
+ {null, new BigDecimal(1)},
+ {null, new BigDecimal(2)},
+ {null, new BigDecimal(3)}
+ };
+ }
+
+ @DataProvider (name = "int-left-null-numbers-provider")
+ public Object[][] createLeftNullInteger () {
+ return new Object[][]{
+ {null, 1},
+ {null, 2},
+ {null, 3}
+ };
+ }
+
+ @DataProvider (name = "long-left-null-numbers-provider")
+ public Object[][] createLeftNullLong () {
+ return new Object[][]{
+ {null, 1L},
+ {null, 2L},
+ {null, 3L}
+ };
+ }
+
+ @DataProvider (name = "short-left-null-numbers-provider")
+ public Object[][] createLeftNullShort () {
+ return new Object[][]{
+ {null, SHORT1},
+ {null, SHORT2},
+ {null, SHORT3}
+ };
+ }
+
+ @DataProvider (name = "bigdecimal-right-null-numbers-provider")
+ public Object[][] createRightNullBigDecimal () {
+ return new Object[][]{
+ {new BigDecimal(2), null},
+ {new BigDecimal(3), null},
+ {new BigDecimal(4), null}
+ };
+ }
+
+ @DataProvider (name = "int-right-null-numbers-provider")
+ public Object[][] createRightNullInteger () {
+ return new Object[][]{
+ {1, null},
+ {2, null},
+ {3, null}
+ };
+ }
+
+ @DataProvider (name = "long-right-null-numbers-provider")
+ public Object[][] createRightNullLong () {
+ return new Object[][]{
+ {1L, null},
+ {2L, null},
+ {3L, null}
+ };
+ }
+
+ @DataProvider (name = "short-right-null-numbers-provider")
+ public Object[][] createRightNullShort () {
+ return new Object[][]{
+ {SHORT1, null},
+ {SHORT2, null},
+ {SHORT3, null}
+ };
+ }
+
+ @DataProvider (name = "bigdecimal-same-numbers-provider")
+ public Object[][] createSameBigDecimal () {
+ return new Object[][]{
+ {new BigDecimal(1), new BigDecimal(1)},
+ {new BigDecimal(2), new BigDecimal(2)},
+ {new BigDecimal(3), new BigDecimal(3)}
+ };
+ }
+
+ @DataProvider (name = "int-same-numbers-provider")
+ public Object[][] createSameInteger () {
+ return new Object[][]{
+ {1, 1},
+ {2, 2},
+ {3, 3}
+ };
+ }
+
+ @DataProvider (name = "long-same-numbers-provider")
+ public Object[][] createSameLong () {
+ return new Object[][]{
+ {1L, 1L},
+ {2L, 2L},
+ {3L, 3L}
+ };
+ }
+
+ @DataProvider (name = "short-same-numbers-provider")
+ public Object[][] createSameShort () {
+ return new Object[][]{
+ {SHORT1, SHORT1},
+ {SHORT2, SHORT2},
+ {SHORT3, SHORT3}
+ };
+ }
+
+ @DataProvider (name = "bigdecimal-smaller-numbers-provider")
+ public Object[][] createSmallerBigDecimal () {
+ return new Object[][]{
+ {new BigDecimal(2), new BigDecimal(1)},
+ {new BigDecimal(3), new BigDecimal(2)},
+ {new BigDecimal(4), new BigDecimal(3)}
+ };
+ }
+
+ @DataProvider (name = "int-smaller-numbers-provider")
+ public Object[][] createSmallerInteger () {
+ return new Object[][]{
+ {2, 1},
+ {3, 2},
+ {4, 3}
+ };
+ }
+
+ @DataProvider (name = "long-smaller-numbers-provider")
+ public Object[][] createSmallerLong () {
+ return new Object[][]{
+ {2L, 1L},
+ {3L, 2L},
+ {4L, 3L}
+ };
+ }
+
+ @DataProvider (name = "short-smaller-numbers-provider")
+ public Object[][] createSmallerShort () {
+ return new Object[][]{
+ {SHORT2, SHORT1},
+ {SHORT3, SHORT2},
+ {SHORT4, SHORT3}
+ };
+ }
+
+ @Test (description = "Tests method SafeNumberUtils.compare(Integer,Integer) with larger", dataProvider = "int-larger-numbers-provider")
+ public void testCompareLarger (final Integer var1, final Integer var2) {
+ // All compare() should always return -1
+ Assert.assertEquals(SafeNumberUtils.compare(var1, var2), -1);
+ }
+
+ @Test (description = "Tests method SafeNumberUtils.compare(Long,Long) with larger", dataProvider = "long-larger-numbers-provider")
+ public void testCompareLarger (final Long var1, final Long var2) {
+ // All compare() should always return -1
+ Assert.assertEquals(SafeNumberUtils.compare(var1, var2), -1);
+ }
+
+ @Test (description = "Tests method SafeNumberUtils.compare(Short,Short) with larger numbers", dataProvider = "short-larger-numbers-provider")
+ public void testCompareLarger (final Short var1, final Short var2) {
+ // All compare() should always return -1
+ Assert.assertEquals(SafeNumberUtils.compare(var1, var2), -1);
+ }
+
+ @Test (description = "Tests method SafeNumberUtils.compare(BigDecimal,BigDecimal) with larger numbers", dataProvider = "bigdecimal-larger-numbers-provider")
+ public void testCompareLarger (final BigDecimal var1, final BigDecimal var2) {
+ // All compare() should always return 1
+ Assert.assertEquals(SafeNumberUtils.compare(var1, var2), -1);
+ }
+
+ @Test (description = "Tests method SafeNumberUtils.compare(Integer,Integer) with left null numbers", dataProvider = "int-left-null-numbers-provider")
+ public void testCompareLeftNull (final Integer var1, final Integer var2) {
+ // All compare() should always return -1
+ Assert.assertEquals(SafeNumberUtils.compare(var1, var2), -1);
+ }
+
+ @Test (description = "Tests method SafeNumberUtils.compare(Long,Long) with left null numbers", dataProvider = "long-left-null-numbers-provider")
+ public void testCompareLeftNull (final Long var1, final Long var2) {
+ // All compare() should always return -1
+ Assert.assertEquals(SafeNumberUtils.compare(var1, var2), -1);
+ }
+
+ @Test (description = "Tests method SafeNumberUtils.compare(Short,Short) with left null numbers", dataProvider = "short-left-null-numbers-provider")
+ public void testCompareLeftNull (final Short var1, final Short var2) {
+ // All compare() should always return -1
+ Assert.assertEquals(SafeNumberUtils.compare(var1, var2), -1);
+ }
+
+ @Test (description = "Tests method SafeNumberUtils.compare(BigDecimal,BigDecimal) with left null numbers", dataProvider = "bigdecimal-left-null-numbers-provider")
+ public void testCompareLeftNull (final BigDecimal var1, final BigDecimal var2) {
+ // All compare() should always return -1
+ Assert.assertEquals(SafeNumberUtils.compare(var1, var2), -1);
+ }
+
+ @Test (description = "Tests method SafeNumberUtils.compare(Integer,Integer) with right null numbers", dataProvider = "int-right-null-numbers-provider")
+ public void testCompareRightNull (final Integer var1, final Integer var2) {
+ // All compare() should always return -1
+ Assert.assertEquals(SafeNumberUtils.compare(var1, var2), 1);
+ }
+
+ @Test (description = "Tests method SafeNumberUtils.compare(Long,Long) with right null numbers", dataProvider = "long-right-null-numbers-provider")
+ public void testCompareRightNull (final Long var1, final Long var2) {
+ // All compare() should always return -1
+ Assert.assertEquals(SafeNumberUtils.compare(var1, var2), 1);
+ }
+
+ @Test (description = "Tests method SafeNumberUtils.compare(Short,Short) with right null numbers", dataProvider = "short-right-null-numbers-provider")
+ public void testCompareRightNull (final Short var1, final Short var2) {
+ // All compare() should always return 1
+ Assert.assertEquals(SafeNumberUtils.compare(var1, var2), 1);
+ }
+
+ @Test (description = "Tests method SafeNumberUtils.compare(BigDecimal,BigDecimal) with right null numbers", dataProvider = "bigdecimal-right-null-numbers-provider")
+ public void testCompareRightNull (final BigDecimal var1, final BigDecimal var2) {
+ // All compare() should always return 1
+ Assert.assertEquals(SafeNumberUtils.compare(var1, var2), 1);
+ }
+
+ @Test (description = "Tests method SafeNumberUtils.compare(Integer,Integer) with same numbers", dataProvider = "int-same-numbers-provider")
+ public void testCompareSame (final Integer var1, final Integer var2) {
+ // All compare() should always return 0
+ Assert.assertEquals(SafeNumberUtils.compare(var1, var2), 0);
+ }
+
+ @Test (description = "Tests method SafeNumberUtils.compare(Long,Long) with same numbers", dataProvider = "long-same-numbers-provider")
+ public void testCompareSame (final Long var1, final Long var2) {
+ // All compare() should always return 0
+ Assert.assertEquals(SafeNumberUtils.compare(var1, var2), 0);
+ }
+
+ @Test (description = "Tests method SafeNumberUtils.compare(Short,Short) with same numbers", dataProvider = "short-same-numbers-provider")
+ public void testCompareSame (final Short var1, final Short var2) {
+ // All compare() should always return -1
+ Assert.assertEquals(SafeNumberUtils.compare(var1, var2), 0);
+ }
+
+ @Test (description = "Tests method SafeNumberUtils.compare(BigDecimal,BigDecimal) with same numbers", dataProvider = "bigdecimal-same-numbers-provider")
+ public void testCompareSame (final BigDecimal var1, final BigDecimal var2) {
+ // All compare() should always return 0
+ Assert.assertEquals(SafeNumberUtils.compare(var1, var2), 0);
+ }
+
+ @Test (description = "Tests method SafeNumberUtils.compare(Integer,Integer) with smaller numbers", dataProvider = "int-smaller-numbers-provider")
+ public void testCompareSmaller (final Integer var1, final Integer var2) {
+ // All compare() should always return 1
+ Assert.assertEquals(SafeNumberUtils.compare(var1, var2), 1);
+ }
+
+ @Test (description = "Tests method SafeNumberUtils.compare(Long,Long) with smaller numbers", dataProvider = "long-smaller-numbers-provider")
+ public void testCompareSmaller (final Long var1, final Long var2) {
+ // All compare() should always return 1
+ Assert.assertEquals(SafeNumberUtils.compare(var1, var2), 1);
+ }
+
+ @Test (description = "Tests method SafeNumberUtils.compare(Short,Short) with smaller numbers", dataProvider = "short-smaller-numbers-provider")
+ public void testCompareSmaller (final Short var1, final Short var2) {
+ // All compare() should always return 1
+ Assert.assertEquals(SafeNumberUtils.compare(var1, var2), 1);
+ }
+
+ @Test (description = "Tests method SafeNumberUtils.compare(BigDecimal,BigDecimal) with smaller numbers", dataProvider = "bigdecimal-smaller-numbers-provider")
+ public void testCompareSmaller (final BigDecimal var1, final BigDecimal var2) {
+ // All compare() should always return 1
+ Assert.assertEquals(SafeNumberUtils.compare(var1, var2), 1);
+ }
+
+}