### Question:
Literals { public static Literal<String> of(String value) { checkNotNull(value,STRING_CANNOT_BE_NULL); return new ImmutableLiteral<String>(value); } private  Literals(); static Literal<String> of(String value); static DurationLiteral of(javax.xml.datatype.Duration duration); static DurationLiteral of(Duration duration); static DateTimeDateTimeLiteralBuilder of(Date date); static DateTimeLiteral of(java.sql.Date date); static DateTimeLiteral of(java.sql.Time time); static DateTimeDateTimeLiteralBuilder of(Calendar calendar); static DateTimeDateTimeLiteralBuilder of(GregorianCalendar calendar); static XMLGregorianCalendarDateTimeLiteralBuilder of(XMLGregorianCalendar calendar); static DateTimeDateTimeLiteralBuilder of(DateTime dateTime); static DurationLiteral duration(long time, TimeUnit unit); static Literal<? extends Serializable> newLiteral(Object value); static TypedLiteral<? extends Serializable> newTypedLiteral(Object value, URI datatype); static LanguageLiteral newLanguageLiteral(String value, String language);  }### Answer:
@Test public void testCreationFromXMLGregorianCalendar$customLocale() { XMLGregorianCalendar xgc = xmlGregorianCalendar(); DateTimeLiteral dateTimeLiteral= Literals. of(xgc). withLocale(Locale.GERMANY). dateTime(); assertThat(this.dateTime,equalTo(dateTimeLiteral)); }
@Test public void testCreationFromXMLGregorianCalendar$customTimeZone() { XMLGregorianCalendar xgc = xmlGregorianCalendar(); TimeZone timeZone = anotherTimeZone(this.dateTime.get()); DateTimeLiteral dateTimeLiteral= Literals. of(xgc). withTimeZone(timeZone). dateTime(); assertThat(this.dateTime,not(equalTo(dateTimeLiteral))); assertThat(this.dateTime.get().compareTo(dateTimeLiteral.get()),not(equalTo(0))); }
@Test public void testCreationFromXMLGregorianCalendar$customDefaults() throws DatatypeConfigurationException { XMLGregorianCalendar xgc = xmlGregorianCalendar(); XMLGregorianCalendar nxgc = DatatypeFactory. newInstance(). newXMLGregorianCalendar( new GregorianCalendar(anotherTimeZone(this.dateTime.get()))); DateTimeLiteral dateTimeLiteral= Literals. of(xgc). withDefaults(nxgc). dateTime(); assertThat(this.dateTime,equalTo(dateTimeLiteral)); }
@Test public void testOf$duration$notNull() throws DatatypeConfigurationException { javax.xml.datatype.Duration dr = (javax.xml.datatype.Duration)javaDuration(); DurationLiteral literal = Literals.of(dr); assertThat(literal,notNullValue()); assertThat(literal.get(),equalTo(jodaDuration())); }
@Test(expected=NullPointerException.class) public void testOf$string$nullValue() { Literals.of((String)null); }
@Test public void testOf$string$notNull() { String data = "value"; Literal<String> literal=Literals.of(data); assertThat(literal.get(),equalTo((Serializable)data.toString())); if(literal instanceof TypedLiteral<?>) { assertThat(((TypedLiteral<?>)literal).type(),equalTo(Datatypes.STRING)); } }