diff --git a/pom.xml b/pom.xml index b61fd665..057b8661 100644 --- a/pom.xml +++ b/pom.xml @@ -30,6 +30,8 @@ true true checkstyle.xml + 1.6 + 1.6 diff --git a/src/test/java/com/github/pedrovgs/problem2/VectorScalarProductTest.java b/src/test/java/com/github/pedrovgs/problem2/VectorScalarProductTest.java index 8cf5e310..ac2f46f0 100644 --- a/src/test/java/com/github/pedrovgs/problem2/VectorScalarProductTest.java +++ b/src/test/java/com/github/pedrovgs/problem2/VectorScalarProductTest.java @@ -79,4 +79,17 @@ public void differentSizeVectorsShouldThrowException() { assertEquals(-4, result); } + @Test public void shouldReturnTrueValueIfHasProductOfMaxIntegerAndZero() { + int max = Integer.MAX_VALUE; + Vector v1 = new Vector(max, max, max, max); + Vector v2 = new Vector(0, 0, 0, 0); + assertEquals(0, vectorScalarProduct.calculateScalarProduct(v1, v2)); + } + + @Test public void shouldReturnTrueValueIfHasProductOfMinIntegerAndZero() { + int min = Integer.MIN_VALUE; + Vector v1 = new Vector(min, min, min, min); + Vector v2 = new Vector(0, 0, 0, 0); + assertEquals(0, vectorScalarProduct.calculateScalarProduct(v1, v2)); + } }