1 /* 2 * ==================================================================== The 3 * Apache Software License, Version 1.1 4 * 5 * Copyright (c) 2003 Digital Clash LLC. All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions are met: 9 * 1. Redistributions of source code must retain the above copyright notice, 10 * this list of conditions and the following disclaimer. 11 * 2. Redistributions in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in the 13 * documentation and/or other materials provided with the distribution. 14 * 3. The end-user documentation included with the redistribution, if any, 15 * must include the following acknowledgment: "This product includes software 16 * developed by the ChronicJ team (http://www.chronicj.org/)." Alternately, 17 * this acknowledgment may appear in the software itself, if and wherever such 18 * third-party acknowledgments normally appear. 19 * 4. The names "ChronicJ" and "Digital Clash" not be used to endorse or 20 * promote products derived from this software without prior written 21 * permission. For written permission, please contact info@digitalclash.com. 22 * 5. Products derived from this software may not be called "ChronicJ", 23 * "Digital Clash", nor may "ChronicJ" or "Digital Clash" appear in their name, 24 * without prior written permission of Digital Clash LLC. 25 * 26 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, 27 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 28 * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 29 * APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 30 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 31 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 32 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 33 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 34 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 35 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 36 * ==================================================================== This 37 * product includes software developed by the by the Apache Software Foundation 38 * (http://www.apache.org/). 39 * ==================================================================== 40 */ 41 package org.chronicj; 42 43 44 /*** 45 * Mock event used for testing. 46 * 47 * @author <a href="mlipper@US-ABP.com">Matthew Lipper</a> 48 * 49 * @see <a href="http://junit.org">JUnit</a> 50 */ 51 public class MockEvent implements Event { 52 private final String name; 53 54 public MockEvent(String eventName) { 55 name = eventName; 56 } 57 58 /* 59 * (non-Javadoc) 60 * 61 * @see org.chronicj.Event#getId() 62 */ 63 public Object getId() { 64 return name; 65 } 66 67 /* 68 * (non-Javadoc) 69 * 70 * @see java.lang.Object#equals(java.lang.Object) 71 */ 72 public boolean equals(Object arg) { 73 if (this == arg) { 74 return true; 75 } 76 77 if (!(arg instanceof Event)) { 78 return false; 79 } 80 81 Event other = (Event) arg; 82 83 //Self-encapsulate 84 return (getId().equals(other.getId())); 85 } 86 87 /* 88 * (non-Javadoc) 89 * 90 * @see java.lang.Object#hashCode() 91 */ 92 public int hashCode() { 93 //Self-encapsulate 94 return getId().hashCode(); 95 } 96 97 /* 98 * (non-Javadoc) 99 * 100 * @see java.lang.Object#toString() 101 */ 102 public String toString() { 103 //Self-encapsulate 104 return getId().toString(); 105 } 106 }

This page was automatically generated by Maven