Package org.castor.core.util

Examples of org.castor.core.util.IdentitySet$Entry


        assertFalse(set.contains(key2));
        assertFalse(set.contains(key3));
    }

    public void testIterator() {
        IdentitySet set = new IdentitySet();
        Object key1 = new Integer(123);
        Object key2 = new Integer(123);
        Object key3 = new Integer(123);

        set.add(key1);
        set.add(key2);
        set.add(key3);
        assertTrue(set.size() == 3);

        Iterator iter = set.iterator();
        while (iter.hasNext()) {
            Object test = iter.next();
            assertTrue((test == key1) || (test == key2) || (test == key3));
        }
    }
View Full Code Here


        }
    }

    public void testRehash() {
        ArrayList keys = new ArrayList();
        IdentitySet set = new IdentitySet();
       
        for (int i = 0; i < 100; i++) {
            Object key = new Integer(i);
            keys.add(key);
            set.add(key);
        }
       
        for (int i = 0; i < 100; i++) {
            Object key = keys.get(i);
            assertTrue(set.contains(key));
        }
    }
View Full Code Here

            assertTrue(set.contains(key));
        }
    }

    public void testToArray() {
        IdentitySet set = new IdentitySet();
        Object key1 = new Integer(123);
        Object key2 = new Integer(123);
        Object key3 = new Integer(123);

        set.add(key1);
        set.add(key2);
        set.add(key3);
        assertTrue(set.size() == 3);

        Object[] oArr = set.toArray();
        if (oArr[0] == key1) {
            if (oArr[1] == key2) {
                assertTrue(oArr[2] == key3);
            } else {
                assertTrue(oArr[2] == key2);
                assertTrue(oArr[1] == key3);
            }
        } else if (oArr[0] == key2) {
            if (oArr[1] == key1) {
                assertTrue(oArr[2] == key3);
            } else {
                assertTrue(oArr[2] == key1);
                assertTrue(oArr[1] == key3);
            }
        } else {
            assertTrue(oArr[0] == key3);
            if (oArr[1] == key1) {
                assertTrue(oArr[2] == key2);
            } else {
                assertTrue(oArr[2] == key1);
                assertTrue(oArr[1] == key2);
            }
        }

        Integer[] iArr = new Integer[1];
        iArr = (Integer[]) set.toArray(iArr);
        if (iArr[0] == key1) {
            if (iArr[1] == key2) {
                assertTrue(iArr[2] == key3);
            } else {
                assertTrue(iArr[2] == key2);
View Full Code Here

                    for (TestMethod testMethod : inputTestData.getTestMethod()) {
                        List<TestRecord> originalTestRecords = testMethod.getTestRecord();
                        for (TestRecord originalTestRecord : originalTestRecords) {
                            if (originalTestRecord.getId().equals(testRecord.get(RECORD_POSITION))) {
                                OutputData outputData = new OutputData();
                                Entry outputEntry = new Entry();
                                outputEntry.setKey(ACTUAL_RESULT);
                                outputEntry.setValue(testRecord.get(ACTUAL_RESULT).toString());
                                outputData.getEntry().add(outputEntry);
                                originalTestRecord.setOutputData(outputData);
                                outputDataAdded = true;
                                break;
                            }
View Full Code Here

                    for (TestMethod testMethod : inputTestData.getTestMethod()) {
                        List<TestRecord> originalTestRecords = testMethod.getTestRecord();
                        for (TestRecord originalTestRecord : originalTestRecords) {
                            if (originalTestRecord.getId().equals(testRecord.get(RECORD_POSITION))) {
                                OutputData outputData = new OutputData();
                                Entry outputEntry = new Entry();
                                outputEntry.setKey(ACTUAL_RESULT);
                                outputEntry.setValue(testRecord.get(ACTUAL_RESULT).toString());
                                Entry durationEntry = new Entry();
                                durationEntry.setKey(DURATION);
                                durationEntry.setValue(testRecord.get(DURATION).toString());
                                outputData.getEntry().add(outputEntry);
                                outputData.getEntry().add(durationEntry);
                                if(testRecord.get(TEST_STATUS) != null){
                                    Entry statusEntry = new Entry();
                                    statusEntry.setKey(TEST_STATUS);
                                    statusEntry.setValue(testRecord.get(TEST_STATUS).toString());
                                    outputData.getEntry().add(statusEntry);
                                }
                               
                               
                                originalTestRecord.setOutputData(outputData);
                                outputDataAdded = true;
                                break;
                            }
                        }
                        if (outputDataAdded) {
                            break;
                        }
                    }
                }else{
                    //Method did not return any data. So only write the duration as output
                    for (TestMethod testMethod : inputTestData.getTestMethod()) {
                        List<TestRecord> originalTestRecords = testMethod.getTestRecord();
                        for (TestRecord originalTestRecord : originalTestRecords) {
                            if (originalTestRecord.getId().equals(testRecord.get(RECORD_POSITION))) {
                                OutputData outputData = new OutputData();
                                Entry durationEntry = new Entry();
                                durationEntry.setKey(DURATION);
                                durationEntry.setValue(testRecord.get(DURATION).toString());
                                outputData.getEntry().add(durationEntry);
                                originalTestRecord.setOutputData(outputData);
                                outputDataAdded = true;
                                break;
                            }
View Full Code Here

TOP

Related Classes of org.castor.core.util.IdentitySet$Entry

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.