Package org.jmock

Examples of org.jmock.Mockery.checking()


    public void testShouldAddRemoteAndRemoteHomeAnnotations() throws Exception {
        Mockery context = new Mockery();
        final IJDTFacade facade = context.mock(IJDTFacade.class);


        context.checking(new Expectations() {
            {
                one(facade).addClassAnnotation("org.superbiz.Store", Remote.class, null);

                Map<String, Object> remoteHomeProps = new HashMap<String, Object>();
                remoteHomeProps.put("value", "org.superbiz.StoreHome");
View Full Code Here


        final States jdbcConn = context.states("jdbc").startsAs("down");
        final States broker = context.states("broker").startsAs("started");

        // simulate jdbc up between hasLock and checkpoint, so hasLock fails to verify
        context.checking(new Expectations() {{
            allowing(brokerService).isRestartAllowed();
            will(returnValue(false));
            allowing(brokerService).stopAllConnectors(with(any(ServiceStopper.class)));
            allowing(brokerService).getPersistenceAdapter();
            will(returnValue(jdbcPersistenceAdapter));
View Full Code Here

        final Connection connection = context.mock(Connection.class);
        final PreparedStatement preparedStatement = context.mock(PreparedStatement.class);
        final ResultSet resultSet = context.mock(ResultSet.class);
        final Timestamp timestamp = context.mock(Timestamp.class);

        context.checking(new Expectations() {{
            allowing(jdbcPersistenceAdapter).getStatements();
            will(returnValue(statements));
            allowing(jdbcPersistenceAdapter);
            allowing(statements);
            allowing(connection).prepareStatement(with(any(String.class)));
View Full Code Here

            }
        };

        final ClassMetadata metadata = mockContext.mock(ClassMetadata.class);

        mockContext.checking(new Expectations() {
            {
                oneOf(metadata).getResourceClass();
                will(returnValue(null));

                oneOf(metadata).getPath();
View Full Code Here

        final ClassMetadata metadata = mockContext.mock(ClassMetadata.class);
        final MethodMetadata methodMeta = mockContext.mock(MethodMetadata.class);
        final java.lang.reflect.Method method =
            BasicResourceWithVoidReturn.class.getMethod("basicReturn");

        mockContext.checking(new Expectations() {
            {
                oneOf(metadata).getResourceClass();
                will(returnValue(BasicResourceWithVoidReturn.class));

                oneOf(metadata).getPath();
View Full Code Here

        final MethodMetadata metadata = mockContext.mock(MethodMetadata.class);
        final ClassMetadata classMeta = mockContext.mock(ClassMetadata.class);
        final java.lang.reflect.Method method =
            BasicResourceWithVoidReturn.class.getMethod("basicReturn");

        mockContext.checking(new Expectations() {
            {
                oneOf(metadata).getHttpMethod();
                will(returnValue("myHttpMethod"));

                oneOf(metadata).getFormalParameters();
View Full Code Here

            }
        };
        final MethodMetadata metadata = mockContext.mock(MethodMetadata.class);
        final ClassMetadata classMeta = mockContext.mock(ClassMetadata.class);

        mockContext.checking(new Expectations() {
            {
                oneOf(metadata).getFormalParameters();
                will(returnValue(null));
            }
        });
View Full Code Here

    @Override
    public void setUp() throws Exception {
        super.setUp();
        Mockery mockery = new Mockery();
        final RuntimeContext context = mockery.mock(RuntimeContext.class);
        mockery.checking(new Expectations() {{
            allowing(context).getAttribute(WinkConfiguration.class); will(returnValue(null));
        }});
       
        RuntimeContextTLS.setRuntimeContext(context);
    }
View Full Code Here

    @Override
    public void setUp() throws Exception {
        super.setUp();
        Mockery mockery = new Mockery();
        final RuntimeContext context = mockery.mock(RuntimeContext.class);
        mockery.checking(new Expectations() {{
            allowing(context).getAttribute(WinkConfiguration.class); will(returnValue(null));
        }});
       
        RuntimeContextTLS.setRuntimeContext(context);
    }
View Full Code Here

        final DatabaseMetaData metadata = context.mock(DatabaseMetaData.class);
        final ResultSet result = context.mock(ResultSet.class);
        adapter.setDataSource(dataSource);
        adapter.setCreateTablesOnStartup(false);

        context.checking(new Expectations() {{
            allowing(dataSource).getConnection();
            will(returnValue(connection));
            allowing(connection).getMetaData();
            will(returnValue(metadata));
            allowing(connection);
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.