Skip to content

Commit

Permalink
Updated m3_12_testCalculateWorksCorrectly with constructor check
Browse files Browse the repository at this point in the history
  • Loading branch information
hhimanshu committed May 20, 2020
1 parent e4092f4 commit 826d714
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/test/java/com/h2/Module3_Test.java
Original file line number Diff line number Diff line change
Expand Up @@ -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<Method> filteredMethod = Arrays.stream(methods).filter(method -> method.getName().equals(methodName)).collect(Collectors.toList());
Expand Down

0 comments on commit 826d714

Please sign in to comment.