01: /*
02: * Copyright 2001-2005 Stephen Colebourne
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16: package org.joda.time;
17:
18: import org.joda.time.chrono.ISOChronology;
19:
20: /**
21: * A basic mock testing class for a PartialInstant that doesn't extend AbstractPartialInstant.
22: *
23: * @author Stephen Colebourne
24: */
25: public class MockPartial implements ReadablePartial {
26:
27: public static final ReadablePartial EMPTY_INSTANCE = new MockPartial();
28:
29: public Chronology getChronology() {
30: return ISOChronology.getInstanceUTC();
31: }
32:
33: public int size() {
34: return getFields().length;
35: }
36:
37: public DateTimeFieldType getFieldType(int index) {
38: return getFields()[index].getType();
39: }
40:
41: public DateTimeField getField(int index) {
42: return getFields()[index];
43: }
44:
45: public int getValue(int index) {
46: return getValues()[index];
47: }
48:
49: public int get(DateTimeFieldType field) {
50: return 0;
51: }
52:
53: public boolean isSupported(DateTimeFieldType field) {
54: return false;
55: }
56:
57: public DateTime toDateTime(DateTimeZone zone) {
58: return null;
59: }
60:
61: public DateTime toDateTime(ReadableInstant base) {
62: return null;
63: }
64:
65: public DateTimeField[] getFields() {
66: return new DateTimeField[0];
67: }
68:
69: public int[] getValues() {
70: return new int[0];
71: }
72: }
|