IDEBus ideBus = FSDriverUtils.getIDEDeviceFactory().createIDEBus(parentDev, primary);
IDEBus ideBus; try { ideBus = IDEDriverUtils.getIDEDeviceFactory().createIDEBus(parentDev, primary); } catch (NamingException ex) { throw new DriverException(ex); }
    public static IDEDevice createIDEDevice(Device parentDev, TestCase testCase,                        final boolean supp48bitsAddr, final long deviceSize)                 throws IllegalArgumentException, DriverException, ResourceNotFreeException    {        if((deviceSize % IDEConstants.SECTOR_SIZE) != 0)        {            throw new IllegalArgumentException("deviceSize("+deviceSize+                    ") must be a multiple of SECTOR_SIZE("+IDEConstants.SECTOR_SIZE+")");        }                boolean master = true;        boolean primary = true;        IDEBus ideBus = FSDriverUtils.getIDEDeviceFactory().createIDEBus(parentDev, primary);                // 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)            {                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};        Object[] args = {data, atapi};        IDEDriveDescriptor desc = (IDEDriveDescriptor)                 MockUtils.createMockObject(IDEDriveDescriptor.class,                                            initializer, clsArgs, args);                DefaultIDEControllerDriver ctrlDriver = new DefaultIDEControllerDriver();        IDEDevice device = new IDEDevice(ideBus, primary, master, "hdTest", desc, ctrlDriver);                return device;    }