From 826d7144c38801e51dde11067007a15b44dd2c5d Mon Sep 17 00:00:00 2001 From: hhimanshu Date: Wed, 20 May 2020 16:36:23 -0700 Subject: [PATCH] Updated m3_12_testCalculateWorksCorrectly with constructor check --- src/test/java/com/h2/Module3_Test.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/test/java/com/h2/Module3_Test.java b/src/test/java/com/h2/Module3_Test.java index 01d15946f..c247e186a 100644 --- a/src/test/java/com/h2/Module3_Test.java +++ b/src/test/java/com/h2/Module3_Test.java @@ -288,6 +288,10 @@ public void m3_12_testCalculateWorksCorrectly() throws IllegalAccessException, I float[] credits = new float[]{10.0f, 20.0f}; float[] debits = new float[]{5.0f}; final Constructor constructor = constructors[0]; + + int parameterCount = constructor.getParameterCount(); + assertEquals(2, parameterCount, classToFind + " must have a constructor with 2 parameters - credits and debits, both should be of type 'float[]'"); + Object instance = constructor.newInstance(credits, debits); final Method[] methods = savingsCalculator.getDeclaredMethods(); final List filteredMethod = Arrays.stream(methods).filter(method -> method.getName().equals(methodName)).collect(Collectors.toList());