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