### Question:
InstantTypeConversion implements TypeConverter.Conversion<Instant> { @Override public Instant convert(Object value) { if (value == null) { return null; } else if (value instanceof Instant) { return (Instant)value; } else if (value instanceof Date) { return ((Date)value).toInstant(); } else if (value instanceof CharSequence) { return Instant.parse((CharSequence)value); } else { return Instant.parse(value.toString()); } }  @Override Object[] getTypeKeys(); @Override Instant convert(Object value);  }### Answer:
@Test public void testInstantTypeConversionWithNullInput(){ InstantTypeConversion instantTypeConversion = new InstantTypeConversion(); assertNull(instantTypeConversion.convert(null)); }
@Test public void testInstantTypeConversionWithInstantInput(){ InstantTypeConversion instantTypeConversion = new InstantTypeConversion(); Instant convertedInstant = instantTypeConversion.convert(Instant.EPOCH); assertEquals(convertedInstant, Instant.EPOCH); }
@Test public void testInstantTypeConversionWithDateInput(){ InstantTypeConversion instantTypeConversion = new InstantTypeConversion(); assertTrue(instantTypeConversion.convert(new Date()) instanceof Instant); }
@Test public void testIntantTypeConversionWithCharacterSequence(){ InstantTypeConversion instantTypeConversion = new InstantTypeConversion(); CharSequence instantCharSeq = "2014-12-03T10:15:30.00Z"; Instant convertedInstant = instantTypeConversion.convert(instantCharSeq); assertEquals(convertedInstant.getNano(), Instant.parse(instantCharSeq).getNano()); }
@Test public void testInstantTypeConversionWithString(){ InstantTypeConversion instantTypeConversion = new InstantTypeConversion(); String instantStr = new String("2014-12-03T10:15:30.00Z"); InstantFormat obj = new InstantFormat(instantStr); Instant convertedInstant = instantTypeConversion.convert(obj); assertEquals(convertedInstant.getNano(), Instant.parse(instantStr).getNano()); }