Skip to content
This repository has been archived by the owner on Sep 26, 2019. It is now read-only.

Commit

Permalink
Additional test checks
Browse files Browse the repository at this point in the history
  • Loading branch information
tmohay committed Nov 29, 2018
1 parent 271b6fd commit a0dc32b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,8 @@ private boolean validatePreprepareCertificateRound(
}

if (prepareCertRound.getRoundNumber() >= roundChangeTarget.getRoundNumber()) {
LOG.info("Invalid RoundChange message, PreprepareCertificate is not for a past round.");
LOG.info(
"Invalid RoundChange message, PreprepareCertificate is newer than RoundChange target.");
return false;
}
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@ public void setup() {

when(block.getHash()).thenReturn(Hash.fromHexStringLenient("1"));
when(validatorFactory.createAt(any())).thenReturn(basicValidator);

// By default, have all basic messages being valid thus any failures are attributed to logic
// in the RoundChangeMessageValidator
when(basicValidator.addPreprepareMessage(any())).thenReturn(true);
when(basicValidator.validatePrepareMessage(any())).thenReturn(true);
}

@Test
Expand Down Expand Up @@ -183,6 +188,9 @@ public void roundChangeWithPreprepareFromARoundAheadOfRoundChangeTargetFails() {
targetRound, Optional.of(prepareCertificate));

assertThat(validator.validateMessage(msg)).isFalse();
verify(validatorFactory, never()).createAt(any());
verify(basicValidator, never()).validatePrepareMessage(prepareMsg);
verify(basicValidator, never()).validateCommmitMessage(any());
}

@Test
Expand Down

0 comments on commit a0dc32b

Please sign in to comment.