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.
}
}
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);
}
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);
}
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);
}
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;
}
Aggregations