Package org.jmock.cglib

Examples of org.jmock.cglib.MockObjectTestCase


        // must have length 256 (see IDEDriveDescriptor)
        int[] data = new int[256];
        Boolean atapi = Boolean.valueOf(true);

        final MockObjectTestCase mockTestCase = (MockObjectTestCase) testCase;
        MockInitializer initializer = new MockInitializer() {
            public void init(Mock mockDesc) {
                BootLogInstance.get().debug("devSize=" + deviceSize);
                Boolean bSupp48bitsAddr = Boolean.valueOf(supp48bitsAddr);
                mockDesc.expects(mockTestCase.atLeastOnce()).
                    method("supports48bitAddressing").
                    withNoArguments().will(new ReturnStub(bSupp48bitsAddr));

                long nbSectors = deviceSize / IDEConstants.SECTOR_SIZE;
                Long lNbSectors = new Long(nbSectors);
                String methodName = supp48bitsAddr ?
                    "getSectorsIn48bitAddressing" :
                    "getSectorsIn28bitAddressing";
                mockDesc.expects(mockTestCase.atLeastOnce()).
                    method(methodName).
                    withNoArguments().will(new ReturnStub(lNbSectors));

            }
        };
View Full Code Here


        return device;
    }

    public static void createResourceManager(TestCase testCase) throws NameAlreadyBoundException, NamingException {
        final MockObjectTestCase mockTestCase = (MockObjectTestCase) testCase;
        MockInitializer initializer = new MockInitializer() {

            public void init(Mock mockResMgr) {
                mockResMgr.expects(mockTestCase.atLeastOnce()).method("claimIOResource").withAnyArguments();
                mockResMgr.expects(mockTestCase.atLeastOnce()).method("claimIRQ").withAnyArguments();
            }
        };
        ResourceManager resMgr = MockUtils.createMockObject(ResourceManager.class, initializer);
        InitialNaming.bind(ResourceManager.NAME, resMgr);
    }
View Full Code Here

TOP

Related Classes of org.jmock.cglib.MockObjectTestCase

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.