Question: Hello, Never mind, configuration issue, I fixed the problem. Thanks This is the whote package Please use Eclipse, this program is in java, I need

Hello,

Never mind, configuration issue, I fixed the problem. Thanks

This is the whote package

Please use Eclipse, this program is in java, I need to create a simple class to display, Hello World from a name. Make sure it passes the test.

Could you please create that class and give me an explanation on why I got these errors.

bellow is the package for testing

Thank you.

/************************JunitJavadocValidation***************************/

package week01;

import static org.junit.Assert.*;

import java.io.PrintStream;

import java.util.ArrayList;

import java.util.List;

import org.junit.Test;

import test.TestResult;

import test.TestResultDetail;

import test.javadoc.FileTestData2;

import test.javadoc.JUnitJavadocValidationUtility2;

import test.javadoc.MethodTestData2;

/**

* Tests the Javadoc in the source file.

*

* @author Dina

*

*/

public class JUnitJavadocValidation

{

public JUnitJavadocValidation()

{

m_stream = System.out; // Standard out

List testFiles = new ArrayList();

List methods = new ArrayList();

methods.add(new MethodTestData2("display", "", "String","public"));

testFiles.add(new FileTestData2("week01", "HelloWorld.java", methods));

m_validator = new JUnitJavadocValidationUtility2("Week01 Javadoc Test",

testFiles);

m_validator.suppressParserTrace(false);

}

@Test

public void testJavadoc()

{

trace("** Validating Javadoc **");

// Update these values for each assignment

// m_packageName = "week02";

TestResult result = m_validator.runTest();

StringBuilder details = new StringBuilder();

if(!result.passed())

{

List detailList = result.getTestResultDetails();

for(TestResultDetail detail : detailList)

{

trace(detail.testDetails());

details.append(detail.testDetails());

details.append(CRLF);

}

}

trace(String.format("** Test result: %s **", result.passed() ? "Passed" : "Failed"));

assertTrue(details.toString(), result.passed());

}

/**

* Trace the msg to a PrintStream Provides the method for tests to report

* status

*

* @param msg

*/

private void trace(String msg)

{

m_stream.println(msg);

}

private JUnitJavadocValidationUtility2 m_validator;

protected PrintStream m_stream;

private static String CRLF = System.getProperty("line.separator");

}

/************************************************/

package week01;

import test.AbstractTestHarness;

/**

* File: TestHarness.java

* @author Dina

*/

class TestHarness extends AbstractTestHarness

{

public static void main(String[] args)

{

new TestHarness().runTests();

}

/**

* Implements the baseclass abstract method

*/

protected void runTests()

{

try

{

boolean javadocTest = executeTest(JUnitJavadocValidation.class);

boolean helloWorldTest = executeTest(TestHelloWorld.class);

boolean result = javadocTest && helloWorldTest;

trace(result ? "Tests Passed" : "Tests Failed");

}

catch(Exception ex)

{

trace(ex.getMessage());

}

}

}

/**************************************************/

package week01;

import static org.junit.Assert.*;

import org.junit.Test;

public class TestHelloWorld

{

/**

* Default constructor

*/

public TestHelloWorld()

{

}

@Test

public void runTest()

{

boolean result = true;

HelloWorld hello = new HelloWorld();

String msg = hello.display();

// trace("Results from executing display() method: ");

// trace(" ");

if(msg.length() > 1 && msg.contains("Hello World from"))

{

result = true;

}

else

{

result = false;

//trace("Message doesn't match requirements - expected Hello World from ");

}

assertTrue("Message doesn't match requirements - expected Hello World from ", result);

}

static private void trace(String msg)

{

System.out.println(msg);

}

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!