Exemplo 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();
 }
Exemplo 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();
 }
Exemplo 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);
 }
Exemplo 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);
 }