Examples of ReturnStub


Examples of org.jmock.core.stub.ReturnStub

    public IDEIO createIDEIO(Device parent, boolean primary) {
        MockInitializer initializer = new MockInitializer() {
            public void init(Mock mockIDEIO) {
                Integer irq = new Integer(13);
                mockIDEIO.expects(testCase.atLeastOnce()).method("getIrq")
                    .withNoArguments().will(new ReturnStub(irq));

                mockIDEIO.expects(testCase.atLeastOnce()).method(
                    "setControlReg").withAnyArguments();

                Integer statusReg = new Integer(13);
                mockIDEIO.expects(testCase.atLeastOnce())
                    .method("getStatusReg").withNoArguments().will(new ReturnStub(statusReg));
            }
        };

        // Class[] argCls = new Class[]{Device.class, boolean.class};
        // Object[] args = new Object[]{parent, Boolean.valueOf(primary)};
View Full Code Here

Examples of org.jmock.core.stub.ReturnStub

                                               final boolean extended, final long startLba, final long nbSectors) {
        MockInitializer initializer = new MockInitializer() {
            public void init(Mock mockEntry) {
                Boolean valid = Boolean.TRUE;
                mockEntry.expects(testCase.atLeastOnce()).method("isValid")
                    .withNoArguments().will(new ReturnStub(valid));

                Boolean bExtended = Boolean.valueOf(extended);
                mockEntry.expects(testCase.atLeastOnce()).method("isExtended")
                    .withNoArguments().will(new ReturnStub(bExtended));

                Long lStartLba = new Long(0);
                mockEntry.expects(testCase.atLeastOnce()).method("getStartLba")
                    .withNoArguments().will(new ReturnStub(lStartLba));

                Long lNbSectors = new Long(nbSectors);
                mockEntry.expects(testCase.atLeastOnce())
                    .method("getNrSectors").withNoArguments().will(new ReturnStub(lNbSectors));
            }
        };

        Class<?>[] argCls = new Class[]{byte[].class, int.class};
        Object[] args = new Object[]{new byte[IDEConstants.SECTOR_SIZE],
View Full Code Here

Examples of org.jmock.core.stub.ReturnStub

                final Partition[] parts = context.getPartitions();
                log.debug("with " + parts.length + " partitions");

                Integer nbParts = new Integer(parts.length);
                mockTable.expects(testCase.atLeastOnce()).method("getLength")
                    .withNoArguments().will(new ReturnStub(nbParts));

                mockTable.expects(testCase.atLeastOnce()).method("getEntry")
                    .withAnyArguments().will(new GetEntryStub(parts));
            }
        };
View Full Code Here

Examples of org.jmock.core.stub.ReturnStub

                // with(new IsInstanceOf(FloppyDriver.class));
                //mockFloppyDevice.expects(testCase.once()).method("setDriver").with(new IsInstanceOf(Driver.class));

                FloppyDriver driver = new FloppyDriver();
                mockFloppyDevice.expects(testCase.atLeastOnce()).method("getDriver").withNoArguments().
                    will(new ReturnStub(driver));
            }

        };

//        Class<?>[] argCls = new Class[]{FloppyControllerBus.class, int.class, FloppyDriveParameters.class};
View Full Code Here

Examples of org.jmock.core.stub.ReturnStub

    public FDC createFDC(Device device) throws DriverException, ResourceNotFreeException {
        MockInitializer initializer = new MockInitializer() {
            public void init(Mock mockFDC) {
                Integer nbStubFloppy = new Integer(1);
                mockFDC.expects(testCase.once()).method("getDriveCount").withNoArguments().
                    will(new ReturnStub(nbStubFloppy));

                FloppyDriveParameters drvParams = createFloppyDriveParameters();
                mockFDC.expects(testCase.atLeastOnce()).method("getDriveParams").withAnyArguments().
                    will(new ReturnStub(drvParams));

                Boolean diskChanged = Boolean.FALSE;
                mockFDC.expects(testCase.atLeastOnce()).method("diskChanged").withAnyArguments().
                    will(new ReturnStub(diskChanged));

                mockFDC.expects(testCase.once()).method("release").withNoArguments();
                mockFDC.expects(testCase.once()).method("reset").withNoArguments();
                mockFDC.expects(testCase.atLeastOnce()).method("executeAndWait").withAnyArguments();
            }
View Full Code Here

Examples of org.jmock.core.stub.ReturnStub

        Class<?>[] argCls = new Class[]{int.class, FloppyDriveParameters.class, FloppyParameters.class};
        Object[] args = new Object[]{new Integer(drive), dp, fp};
        MockInitializer initializer = new MockInitializer() {
            public void init(Mock mockCmd) {
                mockCmd.expects(testCase.atLeastOnce()).method("hasError").withNoArguments().
                    will(new ReturnStub(Boolean.FALSE));
            }
        };

        FloppyDriveParametersCommand cmd = (FloppyDriveParametersCommand) MockUtils
            .createMockObject(FloppyDriveParametersCommand.class, initializer, argCls, args);
View Full Code Here

Examples of org.jmock.core.stub.ReturnStub

        Object[] args = new Object[]{new Integer(drive), geometry, chs, new Integer(currentSectorSize),
            Boolean.valueOf(b), new Integer(gap1Size), dest, new Integer(destOffset)};
        MockInitializer initializer = new MockInitializer() {
            public void init(Mock mockCmd) {
                mockCmd.expects(testCase.atLeastOnce()).method("hasError").withNoArguments().
                    will(new ReturnStub(Boolean.FALSE));
            }
        };

        FloppyReadSectorCommand cmd = (FloppyReadSectorCommand) MockUtils
            .createMockObject(FloppyReadSectorCommand.class, initializer, argCls, args);
View Full Code Here

Examples of org.jmock.core.stub.ReturnStub

        Object[] args = new Object[]{new Integer(drive), geometry, chs, new Integer(currentSectorSize),
            Boolean.valueOf(b), new Integer(gap1Size), src, new Integer(srcOffset)};
        MockInitializer initializer = new MockInitializer() {
            public void init(Mock mockCmd) {
                mockCmd.expects(testCase.atLeastOnce()).method("hasError").withNoArguments().
                    will(new ReturnStub(Boolean.FALSE));
            }
        };

        FloppyWriteSectorCommand cmd = (FloppyWriteSectorCommand) MockUtils
            .createMockObject(FloppyWriteSectorCommand.class, initializer, argCls, args);
View Full Code Here

Examples of org.jmock.core.stub.ReturnStub

        Class<?>[] argCls = new Class[]{int.class};
        Object[] args = new Object[]{new Integer(drive)};
        MockInitializer initializer = new MockInitializer() {
            public void init(Mock mockCmd) {
                mockCmd.expects(testCase.atLeastOnce()).method("hasError").withNoArguments().
                    will(new ReturnStub(Boolean.FALSE));

                Integer sectorSizeIdx = new Integer(2); //FloppyConstants.SECTOR_LENGTH[2]=512
                mockCmd.expects(testCase.atLeastOnce()).method("getSectorSize").withNoArguments().
                    will(new ReturnStub(sectorSizeIdx));
            }
        };

        FloppyIdCommand cmd =
            (FloppyIdCommand) MockUtils.createMockObject(FloppyIdCommand.class, initializer, argCls, args);
View Full Code Here

Examples of org.jmock.core.stub.ReturnStub

            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));

            }
        };

        Class<?>[] clsArgs = {int[].class, boolean.class};
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.