1 4 package com.tc.config.schema.validate; 5 6 import org.apache.xmlbeans.XmlException; 7 import org.apache.xmlbeans.XmlObject; 8 9 public class MockConfigurationValidator implements ConfigurationValidator { 10 11 private int numValidates; 12 private XmlObject lastBean; 13 private XmlException thrownException; 14 15 public MockConfigurationValidator() { 16 this.thrownException = null; 17 18 reset(); 19 } 20 21 public void reset() { 22 this.numValidates = 0; 23 this.lastBean = null; 24 } 25 26 public void validate(XmlObject bean) throws XmlException { 27 ++this.numValidates; 28 this.lastBean = bean; 29 if (this.thrownException != null) throw this.thrownException; 30 } 31 32 public XmlObject getLastBean() { 33 return lastBean; 34 } 35 36 public int getNumValidates() { 37 return numValidates; 38 } 39 40 public void setThrownException(XmlException thrownException) { 41 this.thrownException = thrownException; 42 } 43 44 } 45 | Popular Tags |