1 16 package com.google.gwt.junit.viewer.server; 17 18 import com.google.gwt.junit.viewer.client.Trial; 19 20 import org.w3c.dom.Element ; 21 22 import java.util.Iterator ; 23 import java.util.List ; 24 import java.util.Map ; 25 26 30 class TrialXml { 31 32 public static Trial fromXml(Element element) { 33 Trial trial = new Trial(); 34 35 String timing = element.getAttribute("timing"); 36 37 if (timing != null) { 38 trial.setRunTimeMillis(Double.parseDouble(timing)); 39 } 40 41 Element exception = ReportXml.getElementChild(element, "exception"); 42 if (exception != null) { 43 trial.setException(ReportXml.getText(exception)); 44 } 45 46 List elements = ReportXml.getElementChildren(element, "variable"); 47 48 Map variables = trial.getVariables(); 49 50 for (Iterator it = elements.iterator(); it.hasNext();) { 51 Element e = (Element ) it.next(); 52 String name = e.getAttribute("name"); 53 String value = e.getAttribute("value"); 54 variables.put(name, value); 55 } 56 57 return trial; 58 } 59 } 60 | Popular Tags |