@Test( expectedExceptions = IllegalStateException.class, expectedExceptionsMessageRegExp = "You must supply an acceptance probability.") public void logAcceptanceProbabilityNotSet() throws Exception { ProposalBuilder builder = new ProposalBuilder(); builder.with().modification(modification).build(); }
@Test( expectedExceptions = IllegalStateException.class, expectedExceptionsMessageRegExp = "You must supply a modification.") public void modificationNotSet() throws Exception { ProposalBuilder builder = new ProposalBuilder(); builder.with().build(); }
public void build() throws Exception { ProposalBuilder builder = new ProposalBuilder(); Proposal result = builder .with() .modification(modification) .logAcceptanceProbability(logAcceptanceProbability) .build(); assertThat(result.getLogAcceptanceProbability()).isEqualTo(logAcceptanceProbability); assertThat(result.getModification()).isEqualTo(modification); }
public void reset() throws Exception { ProposalBuilder builder = new ProposalBuilder(); Modification otherModification = mock(Modification.class); double otherProbability = -987654; builder .with() .modification(otherModification) .logAcceptanceProbability(otherProbability) .build(); Proposal result = builder .with() .modification(modification) .logAcceptanceProbability(logAcceptanceProbability) .build(); assertThat(result.getLogAcceptanceProbability()).isEqualTo(logAcceptanceProbability); assertThat(result.getModification()).isEqualTo(modification); }