Esempio n. 1
0
 @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();
 }
Esempio n. 2
0
 @Test(
     expectedExceptions = IllegalStateException.class,
     expectedExceptionsMessageRegExp = "You must supply a modification.")
 public void modificationNotSet() throws Exception {
   ProposalBuilder builder = new ProposalBuilder();
   builder.with().build();
 }
Esempio n. 3
0
 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);
 }
Esempio n. 4
0
 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);
 }