use of org.opengis.util.InternationalString in project sis by apache.
the class TypesTest method testToInternationalString.
/**
* Implementation of {@link #testToInternationalString()} using the given map implementation.
*/
private static void testToInternationalString(final Map<String, Object> properties) {
assertNull(properties.put("name", "Some name"));
assertNull(properties.put("identifier", "Some identifier"));
assertNull(properties.put("code", "Some code"));
assertNull(properties.put("codeSpace", "Some code space"));
assertNull(properties.put("authority", "Some authority"));
assertNull(properties.put("version", "Some version"));
assertNull(properties.put("remarks", "Some remarks"));
assertNull(Types.toInternationalString(properties, "dummy"));
InternationalString i18n = Types.toInternationalString(properties, "remarks");
assertInstanceOf("Single locale", SimpleInternationalString.class, i18n);
assertEquals("Some remarks", i18n.toString());
assertNull(properties.put("remarks_fr", "Une remarque"));
i18n = Types.toInternationalString(properties, "remarks");
assertInstanceOf("Two locales", DefaultInternationalString.class, i18n);
assertEquals("Some remarks", i18n.toString(Locale.ROOT));
assertEquals("Une remarque", i18n.toString(Locale.FRENCH));
assertNotNull(properties.remove("remarks"));
i18n = Types.toInternationalString(properties, "remarks");
assertInstanceOf("Single locale", SimpleInternationalString.class, i18n);
assertEquals("Une remarque", i18n.toString());
}
use of org.opengis.util.InternationalString in project sis by apache.
the class TypesTest method testGetDescription.
/**
* Tests the {@link Types#getDescription(Class)} method.
*/
@Test
public void testGetDescription() {
final InternationalString description = Types.getDescription(OnLineFunction.class);
assertEquals("Function performed by the resource.", description.toString(Locale.ROOT));
assertEquals("Function performed by the resource.", description.toString(Locale.ENGLISH));
assertEquals("Fonctionnalité offerte par la ressource.", description.toString(Locale.FRENCH));
}
use of org.opengis.util.InternationalString in project sis by apache.
the class TypesTest method testGetCodeTitle.
/**
* Tests {@code Types.getCodeTitle(ControlledVocabulary)}.
* Also opportunistically tests {@link Types#forCodeTitle(CharSequence)}.
*/
@Test
public void testGetCodeTitle() {
final InternationalString title = Types.getCodeTitle(OnLineFunction.DOWNLOAD);
assertSame("forCodeTitle", OnLineFunction.DOWNLOAD, Types.forCodeTitle(title));
assertEquals("Download", title.toString(Locale.ROOT));
assertEquals("Download", title.toString(Locale.ENGLISH));
assertEquals("Téléchargement", title.toString(Locale.FRENCH));
}
use of org.opengis.util.InternationalString in project sis by apache.
the class TypesTest method testGetCodeDescription.
/**
* Tests the {@code Types.getDescription(ControlledVocabulary)} method.
*/
@Test
public void testGetCodeDescription() {
final InternationalString description = Types.getDescription(OnLineFunction.DOWNLOAD);
assertEquals("Online instructions for transferring data from one storage device or system to another.", description.toString(Locale.ROOT));
assertEquals("Online instructions for transferring data from one storage device or system to another.", description.toString(Locale.ENGLISH));
assertEquals("Transfert de la ressource d'un système à un autre.", description.toString(Locale.FRENCH));
}
use of org.opengis.util.InternationalString in project sis by apache.
the class NilReasonTest method testCreateNilInternationalString.
/**
* Tests {@link NilReason#createNilObject(Class)} for an international string type.
* Opportunistically tests {@link NilReason#forObject(Object)} with the created object.
*
* @since 0.4
*/
@Test
public void testCreateNilInternationalString() {
final InternationalString value = NilReason.MISSING.createNilObject(InternationalString.class);
assertEquals("", value.toString());
assertInstanceOf("Unexpected impl.", NilObject.class, value);
assertSame("NilReason.forObject(…)", NilReason.MISSING, NilReason.forObject(value));
assertSame("Expected cached value.", value, NilReason.MISSING.createNilObject(InternationalString.class));
}
Aggregations