Package org.jmock

Examples of org.jmock.Mock.proxy()


        Error error = new InternalError("junit");
        mockPico.expects(once()).method("accept").with(same(visitor)).id("1");
        mockPico.expects(once()).method("accept").with(same(visitor)).after("1").will(throwException(error));
        visitor.traverse(mockPico.proxy());
        try {
            visitor.traverse(mockPico.proxy());
            fail("UndeclaredThrowableException expected");
        } catch(InternalError e) {
            assertEquals("junit", e.getMessage());
        }
    }
View Full Code Here


            }
        };

        monitor.expects(once()).method("instantiated").with(eq(emptyHashMapCtor), startIsAfterBegin, durationIsGreaterThanOrEqualToZero);
        ConstructorInjectionComponentAdapter cica = new ConstructorInjectionComponentAdapter(Map.class, HashMap.class,
                new Parameter[0], false, (ComponentMonitor) monitor.proxy());
        cica.getComponentInstance(null);
    }

    public void testMonitoringHappensBeforeAndOnFailOfImpossibleComponentsInstantiation() throws NoSuchMethodException {
        final long beforeTime = System.currentTimeMillis();
View Full Code Here

            }
        };

        monitor.expects(once()).method("instantiationFailed").with(eq(barfingActionListenerCtor), isITE);
        ConstructorInjectionComponentAdapter cica = new ConstructorInjectionComponentAdapter(ActionListener.class, BarfingActionListener.class,
                new Parameter[0], false, (ComponentMonitor) monitor.proxy());
        try {
            cica.getComponentInstance(null);
            fail("Should barf");
        } catch (RuntimeException e) {
            assertEquals("Barf!", e.getMessage());
View Full Code Here

        containerMock.expects(once()).method("getParent").withNoArguments().will(returnValue(null));

        List expected = Arrays.asList(new String[]{"Hello", "World"});
        Collections.sort(expected);
        List actual = Arrays.asList((Object[]) ccp.resolveInstance(
                (PicoContainer) containerMock.proxy(), (ComponentAdapter) componentAdapterMock.proxy(), String[].class));
        Collections.sort(actual);
        assertEquals(expected, actual);
    }

    static public interface Fish {
View Full Code Here

    }

    public void testInvalidConstruction() {
        Mock mockEndpoint = new Mock(MessageEndpoint.class);
        try {
            MessageEndpointProxy proxy = new MessageEndpointProxy((MessageEndpoint) mockEndpoint.proxy());
            fail("An exception should have been thrown");
        } catch (IllegalArgumentException e) {
            assertTrue(true);
        }
    }
View Full Code Here

            }
        });
       
        _server = new MockBpelServer() {
            protected MessageExchangeContext createMessageExchangeContext() {
                return (MessageExchangeContext) partner.proxy();
            }
        };
        _server.deploy(new File(new URI(this.getClass().getResource("/recovery").toString())));
        _management = new BpelManagementFacadeImpl(_server._server,_server._store);
    }
View Full Code Here

   * @throws ValidatorException  when test fails
   */
  public void testNull() throws ValidatorException
  {
    Mock mock = buildMockUIComponent();
    UIComponent component = (UIComponent) mock.proxy();
    MockUIComponentWrapper wrapper = new MockUIComponentWrapper(mock, component);
    LongRangeValidator validator = new LongRangeValidator();

    doTestNull(facesContext, wrapper, validator);
  }
View Full Code Here

   * Test when context is set to null
   */
  public void testNullContext()
  {
    Mock mock = buildMockUIComponent();
    UIComponent component = (UIComponent) mock.proxy();
    MockUIComponentWrapper wrapper = new MockUIComponentWrapper(mock, component);
    LongRangeValidator validator = new LongRangeValidator();

    doTestNullContext(wrapper, validator);
  }
View Full Code Here

  public void testTooLarge()
  {
    // since the pattern has not been set it will be null
    // let us push some arbitary value
    Mock mock = mock(UIComponent.class);
    UIComponent component = (UIComponent) mock.proxy();
    MockUIComponentWrapper wrapper = new MockUIComponentWrapper(mock, component);
    setMockLabelForComponent(wrapper);

    try
    {
View Full Code Here

  public void testWrongType()
  {
    // since the pattern has not been set it will be null
    // let us push some arbitary value
    Mock mock = mock(UIComponent.class);
    UIComponent component = (UIComponent) mock.proxy();
    MockUIComponentWrapper wrapper = new MockUIComponentWrapper(mock, component);
    setMockLabelForComponent(wrapper);

    try
    {
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.