FileDocCategorySizeDatePackage
TestSlotFactory.javaAPI DocphoneME MR2 API (J2ME)2578Wed May 02 18:00:38 BST 2007com.sun.cardreader

TestSlotFactory

public class TestSlotFactory extends com.sun.midp.i3test.TestCase
This test case tests basic SlotFactory functionality, primarily configuration properties.

Fields Summary
public static final int
SLOT_COUNT
Constructors Summary
Methods Summary
public voidrunTests()
Run tests.

        try {
            declare("testInit");
            testInit();

            declare("testSlotCreation");
            testSlotCreation();
        }
        catch (Throwable t) {
            fail("" + t);
        }
    
private voidtestInit()
Test card devices configuration reading and device creation.


                 
          
        boolean stub_flag = false;
        
        try {
            SlotFactory.init();
        }
        catch (CardDeviceException e) {
            if (e.getMessage().equals("stub")) {
                stub_flag = true;
            } else {
                throw e;
            }
        }

        if (!stub_flag) {
            int deviceCount = SlotFactory.getCardDeviceCount();
            assertTrue(deviceCount == 1);
    
            int slotCount = SlotFactory.getCardSlotCount();
            assertTrue(slotCount == 1);
        } else {
            assertTrue(true);
        }
    
private voidtestSlotCreation()
Test card slot creation.

        /* Placeholder */
        assertTrue(true);