1 package net.sourceforge.ejtools.management.test; 2 3 import java.util.Vector ; 4 5 import junit.framework.AssertionFailedError; 6 import junit.framework.Test; 7 8 import org.apache.log4j.Category; 9 10 15 public class ResultSinkImpl implements ResultSink 16 { 17 18 protected Vector errors = new Vector (); 19 20 protected Vector failed = new Vector (); 21 22 protected Vector passed = new Vector (); 23 24 private static Category logger = Category.getInstance(ResultSinkImpl.class); 25 26 27 34 public void addAssert(Test test, String message, boolean condition) 35 { 36 if (condition) 37 { 38 passed.add(message); 39 } 40 else 41 { 42 failed.add(message); 43 } 44 } 45 46 47 52 public void addError(Test test, Throwable t) 53 { 54 errors.add(t.getMessage()); 55 } 56 57 58 63 public void addFailure(Test test, AssertionFailedError afe) { } 64 65 66 public void dump(){ 67 logger.info("--------------------"); 68 for (int i = 0; i < passed.size(); i++) 69 { 70 logger.info("[ PASSED ] " + passed.elementAt(i)); 71 } 72 for (int i = 0; i < failed.size(); i++) 73 { 74 logger.info("[ FAILED ] " + failed.elementAt(i)); 75 } 76 for (int i = 0; i < errors.size(); i++) 77 { 78 logger.info("[ ERROR ] " + errors.elementAt(i)); 79 } 80 logger.info("--------------------"); 81 82 long total = passed.size() + failed.size() + errors.size(); 83 logger.info("Total : " + total); 84 logger.info("Passed : " + passed.size() + "/" + total); 85 logger.info("Failed : " + failed.size() + "/" + total); 86 logger.info("Errors : " + errors.size() + "/" + total); 87 88 logger.info("--------------------"); 89 } 90 91 95 public void endTest(Test arg0) 96 { 97 } 98 99 100 105 public long getPercentage() 106 { 107 return 0; 108 } 109 110 111 115 public void startTest(Test arg0) { } 116 } 117 | Popular Tags |