Java tutorial
/** * Copyright (c) 2007-2009 Zauber S.A. <http://www.zauber.com.ar/> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package ar.com.zauber.garfio.modules.mock.model; import org.apache.commons.lang.Validate; import ar.com.zauber.garfio.modules.model.Issue; /** * Mock implementarion for {@linkplain Issue} * * * @author Juan F. Codagnone * @since Oct 7, 2007 */ public class MockIssue implements Issue { private final String id; /** constructor */ public MockIssue(final String id) { Validate.notEmpty(id); this.id = id; } /** @see Issue#getId() */ public final String getId() { return id; } /** @see Object#equals(Object) */ @Override public final boolean equals(final Object obj) { boolean ret = false; if (obj == this) { ret = true; } else if (obj instanceof Issue) { final Issue issue = (Issue) obj; if (issue != null) { ret = id.equals(issue.getId()); } } return ret; } /** @Object#hashCode() */ @Override public final int hashCode() { return 17 + 19 * id.hashCode(); } }