Skip to content

Commit

Permalink
Merge pull request #5 from pluralsight-projects/master
Browse files Browse the repository at this point in the history
Updated m3_04_testFieldsValueSetWhenConstructorCalled,m3_06_testSumOf…
  • Loading branch information
snychka authored May 21, 2020
2 parents 9031fc5 + eba2eb2 commit 20e2676
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/test/java/com/h2/Module3_Test.java
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@ public void m3_04_testFieldsValueSetWhenConstructorCalled() throws IllegalAccess
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 Field[] fields = savingsCalculator.getDeclaredFields();
Expand Down Expand Up @@ -154,6 +158,10 @@ public void m3_06_testSumOfCreditsWorksCorrectly() throws IllegalAccessException
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 String methodName = "sumOfCredits";
Expand Down Expand Up @@ -196,6 +204,10 @@ public void m3_08_testSumOfDebitsWorksCorrectly() throws IllegalAccessException,
float[] credits = new float[]{10.0f, 20.0f};
float[] debits = new float[]{5.0f, 10.f};
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 String methodName = "sumOfDebits";
Expand Down

0 comments on commit 20e2676

Please sign in to comment.