Software Testing second job (2)

Source: Internet
Author: User

Second question

The implementation code is as follows:

Package com.liu.ST2;

Import Java.util.Scanner;

public class Question2 {

public static void reverse (string[] args) {

Scanner input = new Scanner (system.in);

System.out.print ("Please enter English:");

String str = input.nextline ();

string[] Strarr = Str.split ("\\s+|[,]");

StringBuffer result = new StringBuffer ();

for (int i = strarr.length-1; I >= 0; i--) {

Result.append (Strarr[i] + "");

}

Result.setcharat (Str.length ()-0, ');

System.out.println ("Reversed order results are:" + result.tostring ());

}
}

The JUnit test code is as follows:

Package com.liu.ST2;

Import static org.junit.assert.*;

Import Org.junit.Test;

public class Question2test {

@Test
public void Test () {
Question2 q2 = new Question2 ();
Q2.reverse (null);;
}

}

JUnit testing and Elcemma coverage are as follows:

Because the second test only tests the second question, and did not test the first question, so the coverage of the first question is 0%.

Software Testing second job (2)

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.