optional parameter of Test annotattion

optional parameter of Test annotattion

What are two optional parameters of @Test annotation ?

View Answers

December 6, 2010 at 4:51 PM

The Test annotation supports two optional parameters. The first, expected, declares that a test method should throw an exception. If it doesn't throw an exception or if it throws a different exception than the one declared, the test fails. For example, the following test succeeds :

@Test(expected=IndexOutOfBoundsException.class) public void outOfBounds() {
       new ArrayList<Object>().get(1);
    }

The second optional parameter, timeout, causes a test to fail if it takes longer than a specified amount of clock time (measured in milliseconds). The following test fails :

@Test(timeout=100) public void infinity() {
       while(true);
    }









Related Tutorials/Questions & Answers:
optional parameter of Test annotattion
optional parameter of Test annotattion   What are two optional parameters of @Test annotation ?   The Test annotation supports two optional... parameter, timeout, causes a test to fail if it takes longer than a specified amount
optional parameter of Test annotattion
optional parameter of Test annotattion   The Test annotation supports two optional parameters. The first, expected, declares that a test method... a different exception than the one declared, the test fails. For example, the following
Advertisements
Init Parameter
Init Parameter  How set Init Parameter in servlet
Version of activemq-optional>activemq-optional dependency
List of Version of activemq-optional>activemq-optional dependency
specified in the Optional Package
specified in the Optional Package  What types of DataSource objects are specified in the Optional Package
Java parameter passing
Java parameter passing  What type of parameter passing does Java support
validate parameter before using it
validate parameter before using it   How to validate the parameter before using it in JSP
ModuleNotFoundError: No module named 'optional'
ModuleNotFoundError: No module named 'optional'  Hi, My Python... 'optional' How to remove the ModuleNotFoundError: No module named 'optional... to install padas library. You can install optional python with following
ModuleNotFoundError: No module named 'parameter'
ModuleNotFoundError: No module named 'parameter'  Hi, My Python... 'parameter' How to remove the ModuleNotFoundError: No module named 'parameter' error? Thanks   Hi, In your python environment you
Version of ant>optional dependency
List of Version of ant>optional dependency
Artifacts of activemq-optional
List of Artifacts of activemq-optional maven depenency
Maven Repository/Dependency: activemq-optional | activemq-optional
Maven Repository/Dependency of Group ID activemq-optional and Artifact ID activemq-optional. Latest version of activemq-optional:activemq-optional dependencies. # Version Release Date You
pass parameter names and values
pass parameter names and values  What is the <jsp:param> standard action?   The <jsp:param> standard action is used with <jsp:include> or <jsp:forward> to pass parameter names and values
SQL Out Parameter
SQL Out Parameter       SQL Out Parameter allows the stored procedure to the pass data value ... illustrate an example from SQL Out Parameter .In this Example we create a procedure
Passing a parameter using URL string
Passing a parameter using URL string  How to pass a parameter using the URL string in a JSF application
Maven Dependency activemq-optional >> 3.2
You should include the dependency code given in this page to add Maven Dependency of activemq-optional >> activemq-optional version3.2 in your project
Maven Dependency activemq-optional >> 3.2.1
You should include the dependency code given in this page to add Maven Dependency of activemq-optional >> activemq-optional version3.2.1 in your project
Maven Dependency activemq-optional >> 3.2.2
You should include the dependency code given in this page to add Maven Dependency of activemq-optional >> activemq-optional version3.2.2 in your project
Passing Parameter - JSP-Servlet
Passing Parameter  I would like to ask how to pass a parameter from javascript section into the jsp section.It will be something like this: function change() { var answer = document.getElementById('selc').value
parameter meta data - JDBC
parameter meta data   i wnts to know about the finition of parameter in jdbc as well as the diffrent methods used in parameter meta data  Hi friend, public interface ResultSetMetaData An object that can be used
Version of activemq>activemq-optional dependency
List of Version of activemq>activemq-optional dependency
Version of ant>ant-optional dependency
List of Version of ant>ant-optional dependency
Version of checkstyle>checkstyle-optional dependency
List of Version of checkstyle>checkstyle-optional dependency
Version of tomcat>catalina-optional dependency
List of Version of tomcat>catalina-optional dependency
Version of com.eccyan>rxjava-optional dependency
List of Version of com.eccyan>rxjava-optional dependency
ModuleNotFoundError: No module named 'optional-django'
ModuleNotFoundError: No module named 'optional-django'  Hi, My... named 'optional-django' How to remove the ModuleNotFoundError: No module named 'optional-django' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'optional_import'
ModuleNotFoundError: No module named 'optional_import'  Hi, My... named 'optional_import' How to remove the ModuleNotFoundError: No module named 'optional_import' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'pytest-optional'
ModuleNotFoundError: No module named 'pytest-optional'  Hi, My... named 'pytest-optional' How to remove the ModuleNotFoundError: No module named 'pytest-optional' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'lib-parameter'
ModuleNotFoundError: No module named 'lib-parameter'  Hi, My... 'lib-parameter' How to remove the ModuleNotFoundError: No module named 'lib-parameter' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'magic_parameter'
ModuleNotFoundError: No module named 'magic_parameter'  Hi, My... named 'magic_parameter' How to remove the ModuleNotFoundError: No module named 'magic_parameter' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'parameter-sherpa'
ModuleNotFoundError: No module named 'parameter-sherpa'  Hi, My... named 'parameter-sherpa' How to remove the ModuleNotFoundError: No module named 'parameter-sherpa' error? Thanks   Hi, In your
Passing Parameter - JSP-Servlet
, there's var answer. I need to pass this parameter back into the jsp part, how should i do
Parameter Tag:
Parameter Tag:       bean:parameter...) of the specified request parameter. This tag retrieve the value of the specified request parameter and define the attribute of  type String or String[] in page scope
Version of com.laamella>parameter-source dependency
List of Version of com.laamella>parameter-source dependency
PHP add parameter to url - PHP
PHP add parameter to url  need an example of parse_url in PHP. Thanks in advance
Applet - Passing Parameter in Java Applet
: Then in the function paint (Graphics g), we prints the parameter value to test the value... Applet - Passing Parameter in Java Applet   ... of retrieving the parameter values passed from the html page. So, you can pass
passing parameter from html to applet
passing parameter from html to applet  how to pass the following from HTML to applet in Java code - font size,font style,font size?give me suitable code
Static Parameter
Static Parameter       In this section, we will develop a simple application to access the static parameters. We will use a JavaBean to set and get the static parameters. Each static parameter has a value
how to pass the parameter in callable statement
how to pass the parameter in callable statement  calstat=conn.prepareCall("{call studentrc(?,?,?,?,?)}"); // it show error parameter value is null...=smark1,mark2=smark2,total=stotal where Regno=Regno; end;// how can i pass the parameter
Maven Dependency optional >> 1.5.4
You should include the dependency code given in this page to add Maven Dependency of ant >> optional version1.5.4 in your project
passing .properties file as a parameter to another function
passing .properties file as a parameter to another function  passing .properties file as a parameter to another function in an jsp file
passing .properties file as a parameter to another function
passing .properties file as a parameter to another function  passing .properties file as a parameter to another function in an jsp file
passing .properties file as a parameter to another function
passing .properties file as a parameter to another function  passing .properties file as a parameter to another function in an jsp file
passing .properties file as a parameter to another function
passing .properties file as a parameter to another function  passing .properties file as a parameter to another function in an jsp file
JSP Session Parameter rewrite
JSP Session Parameter rewrite       In the section you will study about the session parameter...; <title>JSP Session Parameter Rewrite</title> </head> <
pass parameter - file - Java Beginners
pass parameter - file  Hi, I want to pass paramter file to method. how it is possible. please send me example programs.   Hi Friend... immediately. file.jsp ========== File Parameter Use
Set Parameter - JSP-Interview Questions
Set Parameter  Hi, could someone please explain the process of setting parameter in the session from JSP with the help of code? Thanks!  Hi,In your JSP page use the Set Tag, and set the scope attribute
ModuleNotFoundError: No module named 'django-template-url-optional'
ModuleNotFoundError: No module named 'django-template-url-optional'  ...: No module named 'django-template-url-optional' How to remove the ModuleNotFoundError: No module named 'django-template-url-optional' error
ModuleNotFoundError: No module named 'odoo10-addon-mail-optional-autofollow'
ModuleNotFoundError: No module named 'odoo10-addon-mail-optional-autofollow...: ModuleNotFoundError: No module named 'odoo10-addon-mail-optional-autofollow' How to remove the ModuleNotFoundError: No module named 'odoo10-addon-mail-optional
ModuleNotFoundError: No module named 'odoo9-addon-mail-optional-autofollow'
ModuleNotFoundError: No module named 'odoo9-addon-mail-optional-autofollow...: ModuleNotFoundError: No module named 'odoo9-addon-mail-optional-autofollow' How to remove the ModuleNotFoundError: No module named 'odoo9-addon-mail-optional

Ads