### Question:
LocaleType extends AbstractType<Locale> { public static Locale toLocale(String val) { String[] tokens = LOCALE.split(val); switch (tokens.length) { case 1: return new Locale(tokens[0]); case 2: return new Locale(tokens[0], tokens[1]); case 3: return new Locale(tokens[0], tokens[1], tokens[2]); } return null; } LocaleType();  LocaleType(int type); @Override Class<Locale> getReturnedClass(); @Override @Nullable Locale getValue(ResultSet rs, int startIndex); static Locale toLocale(String val); @Override void setValue(PreparedStatement st, int startIndex, Locale value);  }### Answer:
@Test public void lang() { Locale l = new Locale("en"); assertEquals(l, LocaleType.toLocale(l.toString())); }
@Test public void lang_country() { Locale l = new Locale("en", "US"); assertEquals(l, LocaleType.toLocale(l.toString())); }
@Test public void lang_country_variant() { Locale l = new Locale("en", "US", "X"); assertEquals(l, LocaleType.toLocale(l.toString())); }