1 4 package org.oddjob.schedules.regression; 5 6 import java.text.DateFormat ; 7 import java.text.ParseException ; 8 import java.text.SimpleDateFormat ; 9 10 import org.oddjob.schedules.Interval; 11 12 16 public class Expected { 17 18 private String from; 19 private String to; 20 21 public void setFrom(String from) { 22 this.from = from; 23 } 24 25 public String getFrom() { 26 return from; 27 } 28 29 public void setTo(String to) throws ParseException { 30 this.to = to; 31 } 32 33 public String getTo() { 34 return to; 35 } 36 37 public Interval getExpected() { 38 DateFormat format = new SimpleDateFormat ("dd-MMM-yy HH:mm:ss:SSS"); 39 40 try { 41 return new Interval(format.parse(this.from), 42 format.parse(to)); 43 } catch (ParseException e) { 44 throw new RuntimeException (e); 45 } 46 } 47 48 public String toString() { 49 return getExpected().toString(); 50 } 51 } 52 53 | Popular Tags |