JDBC: About JUnit Test no tests found matching

Source: Internet
Author: User

When the method being tested contains the called method method labeled "@Test", it will be reported no tests found matching ...

From [email protected] Error, remove the "@Test" of the method being called.

@Test
 public void Testsatement () {
  connection connection=null;
  statement Statement=null;
  resultset Resultset=null;
  try {
   //1. Get database Connection
   connection=getconnection ();
   //2. Call the Createstatement () method of the Connection object to get the statement object
   statement= Connection.createstatement ();
   //3. Prepare SQL statement
   string sql= "Update customers set Name= ' Jerry ' where id=6 ';
   
   //4. Send SQL statement: executeupdate (SQL) method to invoke statement object
    Statement.executeupdate (SQL);
  } catch (Exception e) {
   e.printstacktrace ();
  }finally{
   //5. Close the database resource: off-the-outside
   releasedb (ResultSet, statement, connection);
  }

For example, the above test must ensure that the method getconnection () and Releasedb (ResultSet, statement, connection) should not "@Test", responsible for reporting the above error

Note: JUNIT4----junit_4.12.0.v201504281640


JDBC: About JUnit Test no tests found matching

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.