Examples of FailureStepType


Examples of org.exolab.castor.tests.framework.testDescriptor.types.FailureStepType

        }

        // We expect failure.  Is this the failure we expected?

        String          exceptionName = _failure.getException();
        FailureStepType expectedStep  = _failure.getFailureStep();

        // If no specific step or Exception, then any failure is OK
        if (exceptionName == null && expectedStep == null) {
            return true;
        }

        // If we're expecting an exception, make sure we got the right one
        Exception ex = exception;
        if (ex instanceof NestedIOException) {
            ex = ((NestedIOException)ex).getException();
        }

        if (exceptionName != null) {
            try {
                Class expected = Class.forName(exceptionName);
                if (!expected.isAssignableFrom(ex.getClass())) {
                    String complaint = "Received Exception: '" + ex.getClass().getName()
                            + ": " + ex + "' but expected: '" + exceptionName + "'.";

                    StringWriter sw = new StringWriter();
                    PrintWriter pw = new PrintWriter(sw);
                    pw.print(complaint);
                    if (_verbose) {
                        pw.println("Stacktrace for the Exception that was thrown:");
                        ex.printStackTrace(pw);
                    }
                    pw.flush();
                    System.out.println(sw.toString());

                    fail(complaint);
                }

            } catch (ClassNotFoundException cnfex) {
                fail("The Exception specified: '" + exceptionName + "' cannot be found in the CLASSPATH");
            }
        }

        // If we're expecting to fail at a specific step, make sure this is that step
        if (expectedStep != null && !expectedStep.equals(checkStep)) {
            fail("We expected to fail at test step '" + expectedStep.toString()
                 + "' but actually failed at step '" + checkStep.toString() + "'");
        }

        // We got the expected failure!  Return true.
        return true;
View Full Code Here

Examples of org.exolab.castor.tests.framework.testDescriptor.types.FailureStepType

            if (result == false) {
                verbose("Make sure the reference object model overrides Object#equals");
            }
            verbose("Compare to reference object: " + ((result)?"OK":" ### Failed ### "));

            final FailureStepType step = _failure != null ? _failure.getFailureStep() : null;
            final boolean expectedToFail = _failure != null && _failure.getContent()
                           && (step == null || step.equals(FailureStepType.SECOND_COMPARE));

            if (_failure == null || !_failure.getContent()) {
                assertTrue("The initial reference object and the one resulting of the " +
                           "marshal/unmarshal process are different", result);
            } else if (expectedToFail) {
View Full Code Here

Examples of org.exolab.castor.tests.framework.testDescriptor.types.FailureStepType

                                                      : schemaFile.getAbsolutePath();

        int result = CTFUtils.compare(goldFileName, file.getAbsolutePath());
        verbose("----> Compare marshaled schema to gold file '" + _goldFileName + "': " + ((result == 0)?"OK":"### Failed ### "));

        final FailureStepType step = _failure != null ? _failure.getFailureStep() : null;
        final boolean expectedToFail= _failure != null && _failure.getContent()
                                      && (step == null || step.equals(FailureStepType.COMPARE_TO_REFERENCE));

        if (_failure == null || !_failure.getContent()) {
            assertEquals("The Marshaled schema differs from the gold file", _differenceCountReference, result);
        } else if (expectedToFail) {
            assertTrue("The Marshaled schema was expected to differ from the" +
View Full Code Here

Examples of org.exolab.castor.tests.framework.testDescriptor.types.FailureStepType

        // Compare unmarshaled output file to our initial randomized instance
        boolean result = unmarshaledRandomizedObject.equals(randomizedObject);
        verbose("----> Compare unmarshaled document to reference object: " + ((result)?"OK":"### Failed ### "));

        final FailureStepType step = _failure != null ? _failure.getFailureStep() : null;
        final boolean expectedToFail = _failure != null && _failure.getContent()
                   && (step == null || step.equals(FailureStepType.COMPARE_TO_REFERENCE));

        if (_failure == null || !_failure.getContent()) {
            assertTrue("The initial randomized object and the one resulting of the" +
                       " marshal/unmarshal process are different", result);
        } else if (expectedToFail) {
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.