test/java/time/test/java/time/temporal/MockFieldNoValue.java

Print this page

        

*** 57,73 **** * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package test.java.time.temporal; - import java.time.format.DateTimeBuilder; - import java.time.temporal.*; - import static java.time.temporal.ChronoUnit.MONTHS; import static java.time.temporal.ChronoUnit.WEEKS; import java.time.DateTimeException; /** * Mock TemporalField that returns null. */ public enum MockFieldNoValue implements TemporalField { --- 57,75 ---- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package test.java.time.temporal; import static java.time.temporal.ChronoUnit.MONTHS; import static java.time.temporal.ChronoUnit.WEEKS; import java.time.DateTimeException; + import java.time.temporal.Temporal; + import java.time.temporal.TemporalAccessor; + import java.time.temporal.TemporalField; + import java.time.temporal.TemporalUnit; + import java.time.temporal.ValueRange; /** * Mock TemporalField that returns null. */ public enum MockFieldNoValue implements TemporalField {
*** 94,124 **** return ValueRange.of(1, 20); } //----------------------------------------------------------------------- @Override ! public boolean doIsSupported(TemporalAccessor temporal) { return true; } @Override ! public ValueRange doRange(TemporalAccessor temporal) { return ValueRange.of(1, 20); } @Override ! public long doGet(TemporalAccessor temporal) { throw new DateTimeException("Mock"); } @Override ! public <R extends Temporal> R doWith(R temporal, long newValue) { throw new DateTimeException("Mock"); } - //----------------------------------------------------------------------- - @Override - public boolean resolve(DateTimeBuilder dateTimeBuilder, long value) { - return false; - } - } --- 96,120 ---- return ValueRange.of(1, 20); } //----------------------------------------------------------------------- @Override ! public boolean isSupportedBy(TemporalAccessor temporal) { return true; } @Override ! public ValueRange rangeRefinedBy(TemporalAccessor temporal) { return ValueRange.of(1, 20); } @Override ! public long getFrom(TemporalAccessor temporal) { throw new DateTimeException("Mock"); } @Override ! public <R extends Temporal> R adjustInto(R temporal, long newValue) { throw new DateTimeException("Mock"); } }