Examples of ResultCalculator


Examples of samples.mockpolicy.ResultCalculator

public class MockPolicyWithInvocationHandlerTest {

  @Test
  public void mockPolicyWithInvocationHandlerWorks() throws Exception {
    final SimpleClassWithADependency tested = new SimpleClassWithADependency();
    Whitebox.setInternalState(tested, new ResultCalculator(0));

    assertEquals(1.0, tested.getResult(), 0.0);

    verifyAll();
  }
View Full Code Here

Examples of samples.mockpolicy.ResultCalculator

public class MockPolicyWithExpectationsTest {

  @Test
  public void mockPolicyWithExpectationsWorks() throws Exception {
    final SimpleClassWithADependency tested = new SimpleClassWithADependency();
    Whitebox.setInternalState(tested, new ResultCalculator(5));
   
    assertEquals(2.0, tested.getResult(), 0.0);
   
    verifyAll();
  }
View Full Code Here

Examples of samples.mockpolicy.ResultCalculator

  public void applyClassLoadingPolicy(MockPolicyClassLoadingSettings settings) {
    settings.addFullyQualifiedNamesOfClassesToLoadByMockClassloader(ResultCalculator.class.getName());
  }

  public void applyInterceptionPolicy(MockPolicyInterceptionSettings settings) {
    final ResultCalculator calculatorMock = createMock(ResultCalculator.class);
    expect(calculatorMock.calculate()).andReturn(2.0);

    replay(calculatorMock);

    Method calculateMethod = Whitebox.getMethod(ResultCalculator.class, "calculate");
    settings.stubMethod(calculateMethod, calculatorMock.calculate());
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.