Package org.jmock

Examples of org.jmock.Mockery.checking()


  @Test
  public void testRetornoValidoDoCheckoutComLrIgualA11() {
    Mockery mockery = new Mockery();
    final HttpServletRequest request = mockery.mock(HttpServletRequest.class);   
    mockery.checking(new Expectations(){
      {
        atLeast(1).of(request).getParameter("lr");will(returnValue("11"));                               
      }
    })
    new VISAComponentReturnHandler(criarRetornoDeIntegracao(request)).check();   
View Full Code Here


    @Test
    public void testOnException_Interrupted() {
        final Mockery mockCtx = new JUnit4Mockery();
        final JobExecutor jobEx = mockCtx.mock(JobExecutor.class);
        mockCtx.checking(new Expectations(){{
            allowing(jobEx).isShutdown(); will(returnValue(false));
        }});
        Assert.assertEquals(RecoveryStrategy.PROCEED,
            new DefaultExceptionHandler().onException(jobEx, new InterruptedException("foo"), null));
        mockCtx.assertIsSatisfied();
View Full Code Here

    @Test
    public void testOnException_InterruptedShutdown() {
        final Mockery mockCtx = new JUnit4Mockery();
        final JobExecutor jobEx = mockCtx.mock(JobExecutor.class);
        mockCtx.checking(new Expectations(){{
            allowing(jobEx).isShutdown(); will(returnValue(true));
        }});
        Assert.assertEquals(RecoveryStrategy.TERMINATE,
            new DefaultExceptionHandler().onException(jobEx, new InterruptedException("foo"), null));
        mockCtx.assertIsSatisfied();
View Full Code Here

  @Test
  public void testVerificaRetornoValidoDaTransacao() {
    Mockery mockery = new Mockery();
    final HttpServletRequest request = mockery
        .mock(HttpServletRequest.class);
    mockery.checking(new Expectations() {
      {
        one(request).getParameter("DATA");
        will(returnValue("20090320"));
        one(request).getParameter("NUMPEDIDO");
        will(returnValue("123456"));
View Full Code Here

  @Test
  public void testVerificaRetornoInvalidoDaTransacao() {
    Mockery mockery = new Mockery();
    final HttpServletRequest request = mockery
        .mock(HttpServletRequest.class);
    mockery.checking(new Expectations() {
      {
        one(request).getParameter("DATA");
        will(returnValue("20090320"));
        one(request).getParameter("NUMPEDIDO");
        will(returnValue("123456"));
View Full Code Here

  @Test
  public void testRetornoAutorizacao(){
    Mockery mockery = new Mockery();
    final HttpServletRequest request = mockery.mock(HttpServletRequest.class);
    mockery.checking(new Expectations(){
      {
        atLeast(2).of(request).getParameter("lr");will(returnValue("00"));
        one(request).getParameter("orderid");will(returnValue("123456"));
        one(request).getParameter("free");will(returnValue("free"));
        one(request).getParameter("Price");will(returnValue("100"));
View Full Code Here

 
  @Test
  public void testRetornoCaptura(){
    Mockery mockery = new Mockery();
    final HttpServletRequest request = mockery.mock(HttpServletRequest.class);
    mockery.checking(new Expectations(){
      {
        atLeast(2).of(request).getParameter("lr");will(returnValue("00"));       
        one(request).getParameter("free");will(returnValue("free"));       
        one(request).getParameter("ars");will(returnValue("autorizada"));
        one(request).getParameter("tid");will(returnValue("12345678"));
View Full Code Here

 
  @Test
  public void testRetornoCancelamento(){
    Mockery mockery = new Mockery();
    final HttpServletRequest request = mockery.mock(HttpServletRequest.class);
    mockery.checking(new Expectations(){
      {
        atLeast(2).of(request).getParameter("lr");will(returnValue("00"));       
           
        one(request).getParameter("ars");will(returnValue("autorizada"));
        one(request).getParameter("tid");will(returnValue("12345678"));       
View Full Code Here

 
  @Test
  public void testRetornoConsulta(){
    Mockery mockery = new Mockery();
    final HttpServletRequest request = mockery.mock(HttpServletRequest.class);
    mockery.checking(new Expectations(){
      {
        one(request).getParameter("lr");will(returnValue("00"));
        one(request).getParameter("orderid");will(returnValue("123456"));
        one(request).getParameter("free");will(returnValue("free"));
        one(request).getParameter("price");will(returnValue("100"));
View Full Code Here

        Mockery mockery = new Mockery();
        final MessageProducer messageProducer = mockery.mock(MessageProducer.class);
        final InvalidValue invalidValue = mockery.mock(InvalidValue.class);
        final ValidationMessage validationMessage = mockery.mock(ValidationMessage.class);

        mockery.checking(new Expectations() {
            {
                exactly(1).of(messageProducer).getMessage(invalidValue);
                will(returnValue(validationMessage));
            }
        });
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.