1 11 package org.eclipse.jdt.internal.junit.ui; 12 13 16 public class TestRunInfo extends Object { 17 private String fTestId; 18 private String fTestName; 19 private String fTrace; 20 private String fExpected; 21 private String fActual; 22 23 private int fStatus; 24 25 public TestRunInfo(String testId, String testName){ 26 fTestName= testName; 27 fTestId= testId; 28 } 29 30 33 public int hashCode() { 34 return getTestId().hashCode(); 35 } 36 37 40 public boolean equals(Object obj) { 41 return getTestId().equals(obj); 42 } 43 44 public String getTestId() { 45 return fTestId; 46 } 47 48 public String getTestName() { 49 return fTestName; 50 } 51 52 public String getClassName() { 53 return extractClassName(getTestName()); 54 } 55 56 public String getTestMethodName() { 57 int index= fTestName.indexOf('('); 58 if (index > 0) 59 return fTestName.substring(0, index); 60 index= fTestName.indexOf('@'); 61 if(index > 0) 62 return fTestName.substring(0, index); 63 return fTestName; 64 } 65 66 private String extractClassName(String testNameString) { 67 if (testNameString == null) 68 return null; 69 int index= testNameString.indexOf('('); 70 if (index < 0) 71 return testNameString; 72 testNameString= testNameString.substring(index + 1); 73 return testNameString.substring(0, testNameString.indexOf(')')); 74 } 75 76 public void setTrace(String trace) { 77 fTrace= trace; 78 } 79 80 public String getTrace() { 81 return fTrace; 82 } 83 84 public void setStatus(int status) { 85 fStatus= status; 86 } 87 88 public int getStatus() { 89 return fStatus; 90 } 91 92 public String getActual() { 93 return fActual; 94 } 95 96 public void setActual(String actual) { 97 fActual = actual; 98 } 99 100 public String getExpected() { 101 return fExpected; 102 } 103 104 public void setExpected(String expected) { 105 fExpected = expected; 106 } 107 108 public boolean isComparisonFailure() { 109 return fExpected != null && fActual != null; 110 } 111 } 112 | Popular Tags |