Search in sources :

Example 56 with DateFormatSymbols

use of java.text.DateFormatSymbols in project j2objc by google.

the class DateFormatTest method test_getDateTimeInstance.

/**
	 * @tests java.text.DateFormat#getDateTimeInstance()
	 */
public void test_getDateTimeInstance() {
    SimpleDateFormat f2 = (SimpleDateFormat) DateFormat.getDateTimeInstance();
    assertTrue("Wrong class", f2.getClass() == SimpleDateFormat.class);
    assertTrue("Wrong default", f2.equals(DateFormat.getDateTimeInstance(DateFormat.DEFAULT, DateFormat.DEFAULT, Locale.getDefault())));
    assertTrue("Wrong symbols", f2.getDateFormatSymbols().equals(new DateFormatSymbols()));
    assertTrue("Doesn't work", f2.format(new Date()).getClass() == String.class);
}
Also used : DateFormatSymbols(java.text.DateFormatSymbols) SimpleDateFormat(java.text.SimpleDateFormat) Date(java.util.Date)

Example 57 with DateFormatSymbols

use of java.text.DateFormatSymbols in project j2objc by google.

the class DateFormatTest method test_getInstance.

/**
	 * @tests java.text.DateFormat#getInstance()
	 */
public void test_getInstance() {
    SimpleDateFormat f2 = (SimpleDateFormat) DateFormat.getInstance();
    assertTrue("Wrong class", f2.getClass() == SimpleDateFormat.class);
    assertTrue("Wrong default", f2.equals(DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT, Locale.getDefault())));
    assertTrue("Wrong symbols", f2.getDateFormatSymbols().equals(new DateFormatSymbols()));
    assertTrue("Doesn't work", f2.format(new Date()).getClass() == String.class);
}
Also used : DateFormatSymbols(java.text.DateFormatSymbols) SimpleDateFormat(java.text.SimpleDateFormat) Date(java.util.Date)

Example 58 with DateFormatSymbols

use of java.text.DateFormatSymbols in project j2objc by google.

the class DateFormatSymbolsTest method test_clone.

/**
     * @tests java.text.DateFormatSymbols#clone()
     */
public void test_clone() {
    // Test for method java.lang.Object java.text.DateFormatSymbols.clone()
    DateFormatSymbols symbols = new DateFormatSymbols();
    DateFormatSymbols clone = (DateFormatSymbols) symbols.clone();
    assertTrue("Not equal", symbols.equals(clone));
}
Also used : DateFormatSymbols(java.text.DateFormatSymbols)

Example 59 with DateFormatSymbols

use of java.text.DateFormatSymbols in project j2objc by google.

the class DateFormatSymbolsTest method test_getInstance.

/**
     * @tests java.text.DateFormatSymbols#getInstance()
     */
public void test_getInstance() {
    DateFormatSymbols.getInstance();
    assertEquals(new DateFormatSymbols(), DateFormatSymbols.getInstance());
    assertEquals(new DateFormatSymbols(Locale.getDefault()), DateFormatSymbols.getInstance());
    assertNotSame(DateFormatSymbols.getInstance(), DateFormatSymbols.getInstance());
}
Also used : DateFormatSymbols(java.text.DateFormatSymbols)

Example 60 with DateFormatSymbols

use of java.text.DateFormatSymbols in project j2objc by google.

the class DateFormatSymbolsTest method test_serialization.

// Test serialization mechanism of DateFormatSymbols
public void test_serialization() throws Exception {
    DateFormatSymbols symbols = new DateFormatSymbols(Locale.FRANCE);
    String[][] zoneStrings = symbols.getZoneStrings();
    assertNotNull(zoneStrings);
    // serialize
    ByteArrayOutputStream byteOStream = new ByteArrayOutputStream();
    ObjectOutputStream objectOStream = new ObjectOutputStream(byteOStream);
    objectOStream.writeObject(symbols);
    // and deserialize
    ObjectInputStream objectIStream = new ObjectInputStream(new ByteArrayInputStream(byteOStream.toByteArray()));
    DateFormatSymbols symbolsD = (DateFormatSymbols) objectIStream.readObject();
    String[][] zoneStringsD = symbolsD.getZoneStrings();
    assertNotNull(zoneStringsD);
    assertEquals(symbols, symbolsD);
}
Also used : ByteArrayInputStream(java.io.ByteArrayInputStream) DateFormatSymbols(java.text.DateFormatSymbols) ByteArrayOutputStream(java.io.ByteArrayOutputStream) ObjectOutputStream(java.io.ObjectOutputStream) ObjectInputStream(java.io.ObjectInputStream)

Aggregations

DateFormatSymbols (java.text.DateFormatSymbols)90 SimpleDateFormat (java.text.SimpleDateFormat)30 Date (java.util.Date)23 Locale (java.util.Locale)15 Resources (android.content.res.Resources)12 ArrayList (java.util.ArrayList)11 View (android.view.View)9 TextView (android.widget.TextView)8 OnClickListener (android.view.View.OnClickListener)6 Calendar (java.util.Calendar)6 GregorianCalendar (java.util.GregorianCalendar)6 RelativeLayout (android.widget.RelativeLayout)5 Test (org.junit.Test)5 LayoutParams (android.app.ActionBar.LayoutParams)4 Typeface (android.graphics.Typeface)4 List (java.util.List)4 TypedArray (android.content.res.TypedArray)3 ByteArrayInputStream (java.io.ByteArrayInputStream)3 ByteArrayOutputStream (java.io.ByteArrayOutputStream)3 ObjectInputStream (java.io.ObjectInputStream)3