dcsimg
uml help please
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Anonymous
Posted On:   Saturday, January 15, 2005 05:21 PM

Was wondering if anyone could help me. I have been working on uml for segment of code below but am not sure if I am correct. I have some code from junit below: I have to a. Draw uml class diagram with all associations, relationships etc b. Draw uml design class diagram with all associations, relationships etc c. draw a sequence diagram of doRun(suite) where suite.run(result) cause msg result.addFailure(t,e) Also where do you think instances of the observer pattern exist in the code below from junit any help you can give me would be much appreciated. Thankyou so much, Andrew Test Listener.java ; Public interface TestListener { Void addEr   More>>

Was wondering if anyone could help me. I have been working on uml for segment of code below but am not sure if I am correct. I have some code from junit below:
I have to
a. Draw uml class diagram with all associations, relationships etc
b. Draw uml design class diagram with all associations, relationships etc
c. draw a sequence diagram of doRun(suite) where suite.run(result) cause msg result.addFailure(t,e)

Also where do you think instances of the observer pattern exist in the code below from junit

any help you can give me would be much appreciated.

Thankyou so much,

Andrew

			
Test Listener.java ;

Public interface TestListener {

Void addError(Test test, throwable t);

Void addFailure(Test test, AssertionFailedError t);

Void endTest (Test test);

Void startTest(Test test);

}



ResultPrinter.java

Public class ResultPrinter implements TestListener {

PrintStream fwriter;

PrintStream getWriter() {

return fwriter;

}



public void startTest(Test test) {

get Writer.print(“”);

}

public void endTest(Test test){}



public void addError{Test test, Throwable t){

getWriter().print (“E”);

}

public void addFailure(Test test, Assertion Failed Error t){

getWriter().print(“F”);

}

}

}



TestRunner.java

Result Printer fPrinter;

Void doRun (Test suite){

TestResult result= new TestResult();

Result.addListener (fPrinter);

Suite.run(result);

}

}



TestResult.java

Class TestResult {

Vector fFailures;

Vector fErrors;

Vector fListeners;



Void addListener(TestListener listener) {

FListeners.addElement (listener);

}



void addFailure (Test test, AssertionFailedError t){

fFailures.addElement(new TestFailure(test,t);

for (Enumeration e= fListener.elements(); e.hasmoreElements();)

{

((TestListener)e.nextElement()).addFailure(test,t);

}}



void addError(Test test, Throwable t){

fErrors.addElement (new TestFailure(test,t));

for (Enumeration e=fListener.elements(); e.hasmoreElements();)

{

((TestListener)e.nextElement()).addError(test, t);

}



void endTest(Test test){

for (Enumeration e=fListener.elements();e.hasmoreElements();)

{

((TestListener).e.nextElement()).endTest(test);

}



void startTest(Test test){

for (Enumeration e=fListener.elements();e.hasmoreElements();)

{

((TestListener).e.nextElement()).startTest(test);

}
   <<Less
About | Sitemap | Contact