Search in sources :

Example 26 with EmptyStackException

use of java.util.EmptyStackException in project robovm by robovm.

the class NamespaceSupportTest method testConstructor.

@SuppressWarnings("unchecked")
public void testConstructor() {
    String prefix;
    boolean xmlPrefixExists = false;
    ns = new NamespaceSupport();
    Enumeration<String> prefixes = ns.getDeclaredPrefixes();
    while (prefixes.hasMoreElements()) {
        prefix = prefixes.nextElement();
        if (prefix.equals("xml"))
            xmlPrefixExists = true;
    }
    assertTrue("Test 1: xml prefix does not exist.", xmlPrefixExists);
    // Check that only one context has been created by the constructor.
    try {
        ns.popContext();
        fail("Test 2: EmptyStackException expected.");
    } catch (EmptyStackException e) {
    // Expected.
    }
}
Also used : EmptyStackException(java.util.EmptyStackException) NamespaceSupport(org.xml.sax.helpers.NamespaceSupport)

Example 27 with EmptyStackException

use of java.util.EmptyStackException in project core-java by SpineEventEngine.

the class VerifyShould method fail_assertThrowsWithCause_if_callable_throws_exception_with_different_causes.

@Test(expected = AssertionError.class)
public void fail_assertThrowsWithCause_if_callable_throws_exception_with_different_causes() {
    final Throwable expectedCause = new EmptyStackException();
    final Throwable actualCause = new AclNotFoundException();
    final RuntimeException runtimeException = new RuntimeException(actualCause);
    final Callable throwsRuntimeException = new Callable() {

        @Override
        public Object call() {
            throw runtimeException;
        }
    };
    assertThrowsWithCause(runtimeException.getClass(), expectedCause.getClass(), throwsRuntimeException);
}
Also used : EmptyStackException(java.util.EmptyStackException) AclNotFoundException(java.security.acl.AclNotFoundException) Callable(java.util.concurrent.Callable) Test(org.junit.Test)

Example 28 with EmptyStackException

use of java.util.EmptyStackException in project core-java by SpineEventEngine.

the class VerifyShould method fail_assertThrows_if_callable_not_throws_specified_exception.

@Test(expected = AssertionError.class)
public void fail_assertThrows_if_callable_not_throws_specified_exception() {
    final Callable throwsEmptyStackException = new Callable() {

        @Override
        public Object call() throws Exception {
            throw new EmptyStackException();
        }
    };
    assertThrows(Exception.class, throwsEmptyStackException);
}
Also used : EmptyStackException(java.util.EmptyStackException) Callable(java.util.concurrent.Callable) Test(org.junit.Test)

Example 29 with EmptyStackException

use of java.util.EmptyStackException in project core-java by SpineEventEngine.

the class VerifyShould method fail_assertThrowsWithCause_if_callable_expected_cause_is_null.

@SuppressWarnings("ConstantConditions")
@Test(expected = AssertionError.class)
public void fail_assertThrowsWithCause_if_callable_expected_cause_is_null() {
    final Callable throwsRuntimeException = new Callable() {

        @Override
        public Object call() {
            throw new RuntimeException(new EmptyStackException());
        }
    };
    assertThrowsWithCause(EmptyStackException.class, null, throwsRuntimeException);
}
Also used : EmptyStackException(java.util.EmptyStackException) Callable(java.util.concurrent.Callable) Test(org.junit.Test)

Example 30 with EmptyStackException

use of java.util.EmptyStackException in project Algorithms by wlsgussla123.

the class StackMain method pop.

public int pop() {
    if (isEmpty())
        throw new EmptyStackException();
    int data = top.data;
    top = top.next;
    return data;
}
Also used : EmptyStackException(java.util.EmptyStackException)

Aggregations

EmptyStackException (java.util.EmptyStackException)47 Stack (java.util.Stack)13 Test (org.junit.Test)6 ControlWrapper (com.arjuna.ats.internal.jts.ControlWrapper)5 Callable (java.util.concurrent.Callable)5 NamespaceSupport (org.xml.sax.helpers.NamespaceSupport)5 ActivityImple (com.arjuna.mwlabs.wsas.activity.ActivityImple)3 IOException (java.io.IOException)3 ResourceApplicationContext (com.cloud.spring.module.context.ResourceApplicationContext)2 ConfigCompileException (com.laytonsmith.core.exceptions.ConfigCompileException)2 ArrayList (java.util.ArrayList)2 SystemException (org.omg.CORBA.SystemException)2 ApplicationContext (org.springframework.context.ApplicationContext)2 ActionControl (com.arjuna.ArjunaOTS.ActionControl)1 ControlImple (com.arjuna.ats.internal.jts.orbspecific.ControlImple)1 LightScrollPane (com.jsql.view.swing.scrollpane.LightScrollPane)1 TabHeader (com.jsql.view.swing.tab.TabHeader)1 FileOptions (com.laytonsmith.core.compiler.FileOptions)1 KeywordList (com.laytonsmith.core.compiler.KeywordList)1 CDecimal (com.laytonsmith.core.constructs.CDecimal)1