站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > JBOSS Portal 2.2 API 英文版文档

AssertResult - JBOSS Portal 2.2 API 英文版文档


org.jboss.portal.junit.result
Class AssertResult

java.lang.Object
  extended byorg.jboss.portal.junit.result.ComponentResult
      extended byorg.jboss.portal.junit.result.AssertResult
All Implemented Interfaces:
Result, java.io.Serializable

public class AssertResult
extends ComponentResult

See Also:
Serialized Form

Nested Class Summary
static class AssertResult.Test
           
 
Constructor Summary
AssertResult()
           
 
Method Summary
 void check(int expectedCount)
          Check that the current count is equals to the expected count and that throwable is null.
 void execute(AssertResult.Test test)
          Run the test, record the error or failure if any and increment the count.
 void executeIfNotFailed(AssertResult.Test test)
          Execute the test only if it the result is not failed.
 int getCount()
          Return how many times the execute method has been successfully invoked.
 java.lang.Throwable getThrowable()
          Return the recorded throwable or null if nothing has been recorded.
 boolean isFailed()
          Return true if throwable is null.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AssertResult

public AssertResult()
Method Detail

execute

public void execute(AssertResult.Test test)
             throws java.lang.IllegalArgumentException,
                    java.lang.IllegalStateException
Run the test, record the error or failure if any and increment the count.

Parameters:
test - the test to execute
Throws:
java.lang.IllegalArgumentException - if test is null
java.lang.IllegalStateException - if a throwable has already been recorded previously

executeIfNotFailed

public void executeIfNotFailed(AssertResult.Test test)
                        throws java.lang.IllegalArgumentException
Execute the test only if it the result is not failed.

Parameters:
test - the test to execute
Throws:
java.lang.IllegalArgumentException - if the test is null

getCount

public int getCount()
Return how many times the execute method has been successfully invoked.


getThrowable

public java.lang.Throwable getThrowable()
Return the recorded throwable or null if nothing has been recorded.


isFailed

public boolean isFailed()
Return true if throwable is null.


check

public void check(int expectedCount)
           throws java.lang.Throwable
Check that the current count is equals to the expected count and that throwable is null.

Throws:
junit.framework.AssertionFailedError - if the expected count is not equals to the effective count or the recorded throwable is not null and is an AssertionFailedError
java.lang.Throwable - if the throwable is not null and is not an instance of AssertionFailedError