Package org.jmock

Examples of org.jmock.Mockery


        }
    }
   
    @Before
    public void setup() {
        jmock = new Mockery();
        pa = jmock.mock(PackageAdmin.class);
        rdu = new RefreshDependenciesUtil(pa);
       
        // Test bundle depends on A directly and does not depend on B
        target = setupBundle("testBundle", "com.targetImportsOne;com.targetImportsTwo", null);
View Full Code Here


        Class.forName(MySQLDataType.class.getName());
    }

    @Before
    public void setUp() throws Exception {
        context = new Mockery();
        statement = context.mock(PreparedStatement.class);
        create = DSL.using(SQLDialect.MYSQL);

        resultEmpty = create.newResult(TABLE1);
View Full Code Here

    DomainServiceProviderMockery() {
        init();
    }

    private void init() {
        context = new Mockery() {{
            setImposteriser(JavassistImposteriser.INSTANCE);
        }};
        mocks.clear();
    }
View Full Code Here

    protected Mockery mockeryOf(final Object test) {
        if (mockeryField == null) {
            return null;
        }
        try {
            final Mockery mockery = (Mockery) mockeryField.get(test);
            if (mockery == null) {
                throw new IllegalStateException(String.format("Mockery named '%s' is null", mockeryField.getName()));
            }
            return mockery;
        } catch (final IllegalAccessException e) {
View Full Code Here

    private AbstractContainedObject object;
    private Mockery context;

    @Before
    public void setUp() throws Exception {
        context = new Mockery();
        container = context.mock(DomainObjectContainer.class);
        object = new AbstractContainedObject() {
        };
        object.setContainer(container);
    }
View Full Code Here

    protected Mockery mockeryOf(final Object test) {
        if (mockeryField == null) {
            return null;
        }
        try {
            final Mockery mockery = (Mockery) mockeryField.get(test);
            if (mockery == null) {
                throw new IllegalStateException(String.format("Mockery named '%s' is null", mockeryField.getName()));
            }
            return mockery;
        } catch (final IllegalAccessException e) {
View Full Code Here

    DomainServiceProviderMockery() {
        init();
    }

    private void init() {
        context = new Mockery() {{
            setImposteriser(JavassistImposteriser.INSTANCE);
        }};
        mocks.clear();
    }
View Full Code Here

        final DummyView row = new DummyView();
        final DummyView cell1 = new DummyView();
        final DummyView cell2 = new DummyView();
        row.setupSubviews(new View[] { cell1, cell2 });

        final Mockery mockery = new Mockery();
        final TableAxis tableAxis = mockery.mock(TableAxis.class);

        mockery.checking(new Expectations() {
            {
                one(tableAxis).getColumnWidth(0);
                will(returnValue(80));
                one(tableAxis).getColumnWidth(1);
                will(returnValue(80));
            }
        });

        final TableRowLayout layout = new TableRowLayout(tableAxis);

        layout.layout(row, new Size(200, 200));
        mockery.assertIsSatisfied();

        Assert.assertEquals(new Size(80, 10), cell1.getSize());
        Assert.assertEquals(new Size(80, 10), cell2.getSize());

    }
View Full Code Here

        org.apache.log4j.Logger.getRootLogger().setLevel(org.apache.log4j.Level.OFF);
        TestToolkit.createInstance();

        viewSpecification = new GridListSpecification();

        context = new Mockery();
        collectionContent = context.mock(CollectionContent.class);
        context.checking(new Expectations() {
            {
                one(collectionContent).isCollection();
                will(returnValue(true));
View Full Code Here

    }

    public void testJdbcLockConfigOverride() throws Exception {

        JDBCPersistenceAdapter adapter = new JDBCPersistenceAdapter();
        Mockery context = new Mockery();
        final DataSource dataSource = context.mock(DataSource.class);
        final Connection connection = context.mock(Connection.class);
        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

Related Classes of org.jmock.Mockery

Copyright © 2018 www.massapicom. 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.