001 /*
002 * Copyright 2001-2011 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;
017
018 import org.joda.time.chrono.ISOChronology;
019
020 /**
021 * A basic mock testing class for a PartialInstant that doesn't extend AbstractPartialInstant.
022 *
023 * @author Stephen Colebourne
024 */
025 public class MockPartial implements ReadablePartial {
026
027 public static final ReadablePartial EMPTY_INSTANCE = new MockPartial();
028
029 public Chronology getChronology() {
030 return ISOChronology.getInstanceUTC();
031 }
032 public int size() {
033 return getFields().length;
034 }
035 public DateTimeFieldType getFieldType(int index) {
036 return getFields()[index].getType();
037 }
038 public DateTimeField getField(int index) {
039 return getFields()[index];
040 }
041 public int getValue(int index) {
042 return getValues()[index];
043 }
044 public int get(DateTimeFieldType field) {
045 return 0;
046 }
047 public boolean isSupported(DateTimeFieldType field) {
048 return false;
049 }
050 public DateTime toDateTime(DateTimeZone zone) {
051 return null;
052 }
053 public DateTime toDateTime(ReadableInstant base) {
054 return null;
055 }
056 public DateTimeField[] getFields() {
057 return new DateTimeField[0];
058 }
059 public int[] getValues() {
060 return new int[0];
061 }
062 public int compareTo(ReadablePartial partial) {
063 return 0;
064 }
065 }