FileDocCategorySizeDatePackage
FormatDateRangeTest.javaAPI DocAndroid 1.5 API10513Wed May 06 22:42:42 BST 2009com.android.calendar

FormatDateRangeTest

public class FormatDateRangeTest extends android.test.AndroidTestCase
Unit tests for {@link android.text.format.DateUtils#formatDateRange}.

Fields Summary
private android.content.res.Resources
mResources
DateTest[]
tests
Constructors Summary
Methods Summary
protected voidsetUp()


    
         
        super.setUp();

        mResources = mContext.getResources();
    
public voidtestAll()

        int len = tests.length;
        for (int index = 0; index < len; index++) {
            DateTest dateTest = tests[index];
            long startMillis = dateTest.date1.toMillis(false /* use isDst */);
            long endMillis = dateTest.date2.toMillis(false /* use isDst */);
            int flags = dateTest.flags;
            String output = DateUtils.formatDateRange(mContext, startMillis, endMillis, flags);
            if (!dateTest.expectedOutput.equals(output)) {
                Log.i("FormatDateRangeTest", "index " + index
                        + " expected: " + dateTest.expectedOutput
                        + " actual: " + output);
            }
            assertEquals(dateTest.expectedOutput, output);
        }