001 /*
002 * Copyright 2001-2006 Stephen Colebourne
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016 package org.joda.time.convert;
017
018 import org.joda.time.Chronology;
019 import org.joda.time.DateTimeZone;
020 import org.joda.time.format.DateTimeFormatter;
021
022 /**
023 * A basic mock testing class for a converter.
024 * This converter returns zero and null for an Integer input.
025 *
026 * @author Stephen Colebourne
027 */
028 public class MockZeroNullIntegerConverter implements InstantConverter {
029
030 public static final InstantConverter INSTANCE = new MockZeroNullIntegerConverter();
031
032 public long getInstantMillis(Object object, Chronology chrono) {
033 return 0;
034 }
035
036 public long getInstantMillis(Object object, Chronology chrono, DateTimeFormatter parser) {
037 return 0;
038 }
039
040 public Chronology getChronology(Object object, DateTimeZone zone) {
041 return null;
042 }
043
044 public Chronology getChronology(Object object, Chronology chrono) {
045 return null;
046 }
047
048 public Class getSupportedType() {
049 return Integer.class;
050 }
051 }