* String text, Locale locale) * set(ReadablePartial instant, int
* fieldIndex, int[] values, int newValue) * set(ReadablePartial instant,
* int fieldIndex, int[] values, String text, Locale locale)
*/
public void testUnsupportedMethods() {
DateTimeField fieldOne = UnsupportedDateTimeField.getInstance(
dateTimeFieldTypeOne, UnsupportedDurationField
.getInstance(weeks));
// add(ReadablePartial instant, int fieldIndex, int[] values, int
// valueToAdd)
try {
fieldOne.add(localTime, 0, new int[] { 0, 100 }, 100);
assertTrue(false);
} catch (UnsupportedOperationException e) {
assertTrue(true);
}
// addWrapField(long instant, int value)
try {
fieldOne.addWrapField(100000L, 250);
assertTrue(false);
} catch (UnsupportedOperationException e) {
assertTrue(true);
}
// addWrapField(ReadablePartial instant, int fieldIndex, int[] values,
// int valueToAdd)
try {
fieldOne.addWrapField(localTime, 0, new int[] { 0, 100 }, 100);
assertTrue(false);
} catch (UnsupportedOperationException e) {
assertTrue(true);
}
// addWrapPartial(ReadablePartial instant, int fieldIndex, int[] values,
// int valueToAdd)
try {
fieldOne.addWrapPartial(localTime, 0, new int[] { 0, 100 }, 100);
assertTrue(false);
} catch (UnsupportedOperationException e) {
assertTrue(true);
}
// UnsupportedDateTimeField.get(long instant)
try {
fieldOne.get(1000L);
assertTrue(false);
} catch (UnsupportedOperationException e) {
assertTrue(true);
}
// UnsupportedDateTimeField.getAsShortText(int fieldValue,
// Locale locale)
try {
fieldOne.getAsShortText(0, Locale.getDefault());
assertTrue(false);
} catch (UnsupportedOperationException e) {
assertTrue(true);
}
// UnsupportedDateTimeField.getAsShortText(long instant)
try {
fieldOne.getAsShortText(100000L);
assertTrue(false);
} catch (UnsupportedOperationException e) {
assertTrue(true);
}
// UnsupportedDateTimeField.getAsShortText(long instant, Locale locale)
try {
fieldOne.getAsShortText(100000L, Locale.getDefault());
assertTrue(false);
} catch (UnsupportedOperationException e) {
assertTrue(true);
}
// UnsupportedDateTimeField.getAsShortText(ReadablePartial partial,
// int fieldValue,
// Locale locale)
try {
fieldOne.getAsShortText(localTime, 0, Locale.getDefault());
assertTrue(false);
} catch (UnsupportedOperationException e) {
assertTrue(true);
}
// UnsupportedDateTimeField.getAsShortText(ReadablePartial partial,
// Locale locale)
try {
fieldOne.getAsShortText(localTime, Locale.getDefault());
assertTrue(false);
} catch (UnsupportedOperationException e) {
assertTrue(true);
}
// UnsupportedDateTimeField.getAsText(int fieldValue,
// Locale locale)
try {
fieldOne.getAsText(0, Locale.getDefault());
assertTrue(false);
} catch (UnsupportedOperationException e) {
assertTrue(true);
}
// UnsupportedDateTimeField.getAsText(long instant)
try {
fieldOne.getAsText(1000L);
assertTrue(false);
} catch (UnsupportedOperationException e) {
assertTrue(true);
}
// UnsupportedDateTimeField.getAsText(long instant, Locale locale)
try {
fieldOne.getAsText(1000L, Locale.getDefault());
assertTrue(false);
} catch (UnsupportedOperationException e) {
assertTrue(true);
}
// UnsupportedDateTimeField.getAsText(ReadablePartial partial,
// int fieldValue,
// Locale locale)
try {
fieldOne.getAsText(localTime, 0, Locale.getDefault());
assertTrue(false);
} catch (UnsupportedOperationException e) {
assertTrue(true);
}
// UnsupportedDateTimeField.getAsText(ReadablePartial partial,
// Locale locale)
try {
fieldOne.getAsText(localTime, Locale.getDefault());
assertTrue(false);
} catch (UnsupportedOperationException e) {
assertTrue(true);
}
// UnsupportedDateTimeField.getLeapAmount(long instant) is unsupported
// and should always thrown an UnsupportedOperationException
try {
fieldOne.getLeapAmount(System.currentTimeMillis());
assertTrue(false);
} catch (UnsupportedOperationException e) {
assertTrue(true);
}
// UnsupportedDateTimeField.getMaximumShortTextLength(Locale locale)
// is unsupported and should always thrown an
// UnsupportedOperationException
try {
fieldOne.getMaximumShortTextLength(Locale.getDefault());
assertTrue(false);
} catch (UnsupportedOperationException e) {
assertTrue(true);
}
// UnsupportedDateTimeField.getMaximumTextLength(Locale locale)
// is unsupported and should always thrown an
// UnsupportedOperationException
try {
fieldOne.getMaximumTextLength(Locale.getDefault());
assertTrue(false);
} catch (UnsupportedOperationException e) {
assertTrue(true);
}
// UnsupportedDateTimeField.getMaximumValue() is unsupported
// and should always thrown an UnsupportedOperationException
try {
fieldOne.getMaximumValue();
assertTrue(false);
} catch (UnsupportedOperationException e) {
assertTrue(true);
}
// UnsupportedDateTimeField.getMaximumValue(long instant)
// is unsupported and should always thrown an
// UnsupportedOperationException
try {
fieldOne.getMaximumValue(1000000L);
assertTrue(false);
} catch (UnsupportedOperationException e) {
assertTrue(true);
}
// UnsupportedDateTimeField.getMaximumValue(ReadablePartial instant)
// is unsupported and should always thrown an
// UnsupportedOperationException
try {
fieldOne.getMaximumValue(localTime);
assertTrue(false);
} catch (UnsupportedOperationException e) {
assertTrue(true);
}
// UnsupportedDateTimeField.getMaximumValue(ReadablePartial instant,
// int[] values)
// is unsupported and should always thrown an
// UnsupportedOperationException
try {
fieldOne.getMaximumValue(localTime, new int[] { 0 });
assertTrue(false);
} catch (UnsupportedOperationException e) {
assertTrue(true);
}
// UnsupportedDateTimeField.getMinumumValue() is unsupported
// and should always thrown an UnsupportedOperationException
try {
fieldOne.getMinimumValue();
assertTrue(false);
} catch (UnsupportedOperationException e) {
assertTrue(true);
}
// UnsupportedDateTimeField.getMinumumValue(long instant) is unsupported
// and should always thrown an UnsupportedOperationException
try {
fieldOne.getMinimumValue(10000000L);
assertTrue(false);
} catch (UnsupportedOperationException e) {
assertTrue(true);
}
// UnsupportedDateTimeField.getMinumumValue(ReadablePartial instant)
// is unsupported and should always thrown an
// UnsupportedOperationException
try {
fieldOne.getMinimumValue(localTime);
assertTrue(false);
} catch (UnsupportedOperationException e) {
assertTrue(true);
}
// UnsupportedDateTimeField.getMinumumValue(ReadablePartial instant,
// int[] values) is unsupported
// and should always thrown an UnsupportedOperationException
try {
fieldOne.getMinimumValue(localTime, new int[] { 0 });
assertTrue(false);
} catch (UnsupportedOperationException e) {
assertTrue(true);
}
// UnsupportedDateTimeField.isLeap(long instant) is unsupported and
// should always thrown an UnsupportedOperationException
try {
fieldOne.isLeap(System.currentTimeMillis());
assertTrue(false);
} catch (UnsupportedOperationException e) {
assertTrue(true);
}
// UnsupportedDateTimeField.remainder(long instant) is unsupported and
// should always thrown an UnsupportedOperationException
try {
fieldOne.remainder(1000000L);
assertTrue(false);
} catch (UnsupportedOperationException e) {
assertTrue(true);
}
// UnsupportedDateTimeField.roundCeiling(long instant) is unsupported
// and
// should always thrown an UnsupportedOperationException
try {
fieldOne.roundCeiling(1000000L);
assertTrue(false);
} catch (UnsupportedOperationException e) {
assertTrue(true);
}
// UnsupportedDateTimeField.roundFloor(long instant) is unsupported and
// should always thrown an UnsupportedOperationException
try {
fieldOne.roundFloor(1000000L);
assertTrue(false);
} catch (UnsupportedOperationException e) {
assertTrue(true);
}
// UnsupportedDateTimeField.roundHalfCeiling(long instant) is
// unsupported and
// should always thrown an UnsupportedOperationException
try {
fieldOne.roundHalfCeiling(1000000L);
assertTrue(false);
} catch (UnsupportedOperationException e) {
assertTrue(true);
}
// UnsupportedDateTimeField.roundHalfEven(long instant) is unsupported
// and
// should always thrown an UnsupportedOperationException
try {
fieldOne.roundHalfEven(1000000L);
assertTrue(false);
} catch (UnsupportedOperationException e) {
assertTrue(true);
}
// UnsupportedDateTimeField.roundHalfFloor(long instant) is unsupported
// and
// should always thrown an UnsupportedOperationException
try {
fieldOne.roundHalfFloor(1000000L);
assertTrue(false);
} catch (UnsupportedOperationException e) {
assertTrue(true);
}
// UnsupportedDateTimeField.set(long instant, int value) is unsupported
// and
// should always thrown an UnsupportedOperationException
try {
fieldOne.set(1000000L, 1000);
assertTrue(false);
} catch (UnsupportedOperationException e) {
assertTrue(true);
}
// UnsupportedDateTimeField.set(long instant, String test) is
// unsupported and
// should always thrown an UnsupportedOperationException
try {
fieldOne.set(1000000L, "Unsupported Operation");
assertTrue(false);
} catch (UnsupportedOperationException e) {
assertTrue(true);
}
// UnsupportedDateTimeField.set(long instant, String text, Locale
// locale)
// is unsupported and should always thrown an
// UnsupportedOperationException
try {
fieldOne
.set(1000000L, "Unsupported Operation", Locale.getDefault());
assertTrue(false);
} catch (UnsupportedOperationException e) {
assertTrue(true);
}
// UnsupportedDateTimeField.set(ReadablePartial instant,
// int fieldIndex,
// int[] values,
// int newValue) is unsupported and
// should always thrown an UnsupportedOperationException
try {
fieldOne.set(localTime, 0, new int[] { 0 }, 10000);
assertTrue(false);
} catch (UnsupportedOperationException e) {
assertTrue(true);
}
// UnsupportedDateTimeField.set(ReadablePartial instant,
// int fieldIndex,
// int[] values,
// String text,
// Locale locale) is unsupported and
// should always thrown an UnsupportedOperationException
try {
fieldOne.set(localTime, 0, new int[] { 0 },
"Unsupported Operation", Locale.getDefault());
assertTrue(false);
} catch (UnsupportedOperationException e) {
assertTrue(true);
}