1 package com.mockobjects.jms; 2 3 import com.mockobjects.MockObject; 4 import com.mockobjects.ReturnValue; 5 6 import javax.jms.JMSException ; 7 import javax.jms.Queue ; 8 9 public class MockQueue extends MockObject implements Queue { 10 11 private JMSException myException; 12 private final ReturnValue myName = new ReturnValue("name"); 13 14 public String getQueueName() throws JMSException { 15 throwExceptionIfAny(); 16 return (String )myName.getValue(); 17 } 18 19 public void setupGetQueueName(final String name){ 20 myName.setValue(name); 21 } 22 23 public String toString() { 24 return this.getClass().getName() + ", " + myName.getValue(); 25 } 26 27 public void setupThrowException(JMSException e) { 28 myException = e; 29 } 30 31 protected void throwExceptionIfAny() throws JMSException { 32 if (null != myException) { 33 throw myException; 34 } 35 } 36 } | Popular Tags |