From f1c3cb0fb32764397705c588ed82a9b31a9716d3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Wed, 19 Oct 2022 13:34:34 +0200 Subject: [PATCH] Continued: - added GIT hook "pre-commit" which you should copy to .git/hooks/ or symlink it there - renamed Comparables -> ComparableUtils to conform with naming-convention --- commit-hooks/README.txt | 2 ++ commit-hooks/pre-commit | 6 +++++ ...{Comparables.java => ComparableUtils.java} | 4 ++-- ...blesTest.java => ComparableUtilsTest.java} | 24 +++++++++---------- 4 files changed, 22 insertions(+), 14 deletions(-) create mode 100644 commit-hooks/README.txt create mode 100755 commit-hooks/pre-commit rename src/org/mxchange/jcoreutils/comparable/{Comparables.java => ComparableUtils.java} (95%) rename test/org/mxchange/jcoreutils/test/comparable/{ComparablesTest.java => ComparableUtilsTest.java} (66%) diff --git a/commit-hooks/README.txt b/commit-hooks/README.txt new file mode 100644 index 0000000..6bacfed --- /dev/null +++ b/commit-hooks/README.txt @@ -0,0 +1,2 @@ +Please copy these scripts to your clone-directory's .git/hooks/ directory to +have e.g. unit-tests being run. diff --git a/commit-hooks/pre-commit b/commit-hooks/pre-commit new file mode 100755 index 0000000..22bef22 --- /dev/null +++ b/commit-hooks/pre-commit @@ -0,0 +1,6 @@ +#!/bin/sh + +echo "$0: Running unit tests ..." +ant -silent test || exit 255 + +echo "$0: All done." diff --git a/src/org/mxchange/jcoreutils/comparable/Comparables.java b/src/org/mxchange/jcoreutils/comparable/ComparableUtils.java similarity index 95% rename from src/org/mxchange/jcoreutils/comparable/Comparables.java rename to src/org/mxchange/jcoreutils/comparable/ComparableUtils.java index ee7951b..bfc6063 100644 --- a/src/org/mxchange/jcoreutils/comparable/Comparables.java +++ b/src/org/mxchange/jcoreutils/comparable/ComparableUtils.java @@ -23,7 +23,7 @@ import java.io.Serializable; *

* @author Roland Häder */ -public class Comparables implements Serializable { +public class ComparableUtils implements Serializable { /** * Serial number @@ -63,7 +63,7 @@ public class Comparables implements Serializable { /** * Utility classes should not have instances */ - private Comparables () { + private ComparableUtils () { } } diff --git a/test/org/mxchange/jcoreutils/test/comparable/ComparablesTest.java b/test/org/mxchange/jcoreutils/test/comparable/ComparableUtilsTest.java similarity index 66% rename from test/org/mxchange/jcoreutils/test/comparable/ComparablesTest.java rename to test/org/mxchange/jcoreutils/test/comparable/ComparableUtilsTest.java index 2c734dd..8a7987d 100644 --- a/test/org/mxchange/jcoreutils/test/comparable/ComparablesTest.java +++ b/test/org/mxchange/jcoreutils/test/comparable/ComparableUtilsTest.java @@ -16,49 +16,49 @@ */ package org.mxchange.jcoreutils.test.comparable; -import org.mxchange.jcoreutils.comparable.Comparables; +import org.mxchange.jcoreutils.comparable.ComparableUtils; import org.testng.Assert; import org.testng.annotations.Test; /** - * Test cases for Comparables utlities class + * Test cases for ComparableUtils utilities class *

* @author Roland Häder */ -public class ComparablesTest { +public class ComparableUtilsTest { /** * Default constructor */ - public ComparablesTest () { + public ComparableUtilsTest () { } @Test (description = "Tests if 1 is returned") public void testAboveZero () { // Test method - Assert.assertEquals(Comparables.checkAll(new int[]{0, 0, 1}), 1); - Assert.assertEquals(Comparables.checkAll(new int[]{0, 0, 10}), 1); - Assert.assertEquals(Comparables.checkAll(new int[]{0, 0, 100}), 1); + Assert.assertEquals(ComparableUtils.checkAll(new int[]{0, 0, 1}), 1); + Assert.assertEquals(ComparableUtils.checkAll(new int[]{0, 0, 10}), 1); + Assert.assertEquals(ComparableUtils.checkAll(new int[]{0, 0, 100}), 1); } @Test (description = "Tests if -1 is returned") public void testBelowZero () { // Test method - Assert.assertEquals(Comparables.checkAll(new int[]{0, 0, -1}), -1); - Assert.assertEquals(Comparables.checkAll(new int[]{0, 0, -10}), -1); - Assert.assertEquals(Comparables.checkAll(new int[]{0, 0, -100}), -1); + Assert.assertEquals(ComparableUtils.checkAll(new int[]{0, 0, -1}), -1); + Assert.assertEquals(ComparableUtils.checkAll(new int[]{0, 0, -10}), -1); + Assert.assertEquals(ComparableUtils.checkAll(new int[]{0, 0, -100}), -1); } @Test (description = "Tests if when provided array is empty a specific exception is thrown", expectedExceptions = {IllegalArgumentException.class}) public void testIllegalArgumentException () { // Test method - Comparables.checkAll(new int[]{}); + ComparableUtils.checkAll(new int[]{}); } @Test (description = "Tests if zero is returned") public void testZero () { // Test method - Assert.assertEquals(Comparables.checkAll(new int[]{0, 0, 0}), 0); + Assert.assertEquals(ComparableUtils.checkAll(new int[]{0, 0, 0}), 0); } } -- 2.39.5