Skip to content

Commit

Permalink
Merge pull request #4 from pluralsight-projects/master
Browse files Browse the repository at this point in the history
Updated m3_12_testCalculateWorksCorrectly with constructor check
  • Loading branch information
snychka authored May 20, 2020
2 parents 9370064 + 826d714 commit ef265e2
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 ef265e2

Please sign in to comment.