106c5f8a768bcd4f7b6441f7525bd5c639399fc76Jeff Sharkey/*
206c5f8a768bcd4f7b6441f7525bd5c639399fc76Jeff Sharkey * Copyright (C) 2012 The Android Open Source Project
306c5f8a768bcd4f7b6441f7525bd5c639399fc76Jeff Sharkey *
406c5f8a768bcd4f7b6441f7525bd5c639399fc76Jeff Sharkey * Licensed under the Apache License, Version 2.0 (the "License");
506c5f8a768bcd4f7b6441f7525bd5c639399fc76Jeff Sharkey * you may not use this file except in compliance with the License.
606c5f8a768bcd4f7b6441f7525bd5c639399fc76Jeff Sharkey * You may obtain a copy of the License at
706c5f8a768bcd4f7b6441f7525bd5c639399fc76Jeff Sharkey *
806c5f8a768bcd4f7b6441f7525bd5c639399fc76Jeff Sharkey *      http://www.apache.org/licenses/LICENSE-2.0
906c5f8a768bcd4f7b6441f7525bd5c639399fc76Jeff Sharkey *
1006c5f8a768bcd4f7b6441f7525bd5c639399fc76Jeff Sharkey * Unless required by applicable law or agreed to in writing, software
1106c5f8a768bcd4f7b6441f7525bd5c639399fc76Jeff Sharkey * distributed under the License is distributed on an "AS IS" BASIS,
1206c5f8a768bcd4f7b6441f7525bd5c639399fc76Jeff Sharkey * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1306c5f8a768bcd4f7b6441f7525bd5c639399fc76Jeff Sharkey * See the License for the specific language governing permissions and
1406c5f8a768bcd4f7b6441f7525bd5c639399fc76Jeff Sharkey * limitations under the License.
1506c5f8a768bcd4f7b6441f7525bd5c639399fc76Jeff Sharkey */
1606c5f8a768bcd4f7b6441f7525bd5c639399fc76Jeff Sharkey
1706c5f8a768bcd4f7b6441f7525bd5c639399fc76Jeff Sharkeypackage android.text.format;
1806c5f8a768bcd4f7b6441f7525bd5c639399fc76Jeff Sharkey
1906c5f8a768bcd4f7b6441f7525bd5c639399fc76Jeff Sharkeyimport android.test.suitebuilder.annotation.SmallTest;
2006c5f8a768bcd4f7b6441f7525bd5c639399fc76Jeff Sharkey
2106c5f8a768bcd4f7b6441f7525bd5c639399fc76Jeff Sharkeyimport junit.framework.TestCase;
2206c5f8a768bcd4f7b6441f7525bd5c639399fc76Jeff Sharkey
2306c5f8a768bcd4f7b6441f7525bd5c639399fc76Jeff Sharkeypublic class DateFormatTest extends TestCase {
2406c5f8a768bcd4f7b6441f7525bd5c639399fc76Jeff Sharkey    @SmallTest
2506c5f8a768bcd4f7b6441f7525bd5c639399fc76Jeff Sharkey    public void testHasDesignator() throws Exception {
2606c5f8a768bcd4f7b6441f7525bd5c639399fc76Jeff Sharkey        assertTrue(DateFormat.hasDesignator("hh:mm:ss", DateFormat.MINUTE));
2706c5f8a768bcd4f7b6441f7525bd5c639399fc76Jeff Sharkey        assertTrue(DateFormat.hasDesignator("myyyy", DateFormat.MINUTE));
2806c5f8a768bcd4f7b6441f7525bd5c639399fc76Jeff Sharkey        assertTrue(DateFormat.hasDesignator("mmm", DateFormat.MINUTE));
2906c5f8a768bcd4f7b6441f7525bd5c639399fc76Jeff Sharkey
3006c5f8a768bcd4f7b6441f7525bd5c639399fc76Jeff Sharkey        assertFalse(DateFormat.hasDesignator("hh:MM:ss", DateFormat.MINUTE));
3106c5f8a768bcd4f7b6441f7525bd5c639399fc76Jeff Sharkey    }
3206c5f8a768bcd4f7b6441f7525bd5c639399fc76Jeff Sharkey
3306c5f8a768bcd4f7b6441f7525bd5c639399fc76Jeff Sharkey    @SmallTest
3406c5f8a768bcd4f7b6441f7525bd5c639399fc76Jeff Sharkey    public void testHasDesignatorEscaped() throws Exception {
3506c5f8a768bcd4f7b6441f7525bd5c639399fc76Jeff Sharkey        assertTrue(DateFormat.hasDesignator("hh:mm 'LOL'", DateFormat.MINUTE));
3606c5f8a768bcd4f7b6441f7525bd5c639399fc76Jeff Sharkey
3706c5f8a768bcd4f7b6441f7525bd5c639399fc76Jeff Sharkey        assertFalse(DateFormat.hasDesignator("hh:mm 'yyyy'", DateFormat.YEAR));
3806c5f8a768bcd4f7b6441f7525bd5c639399fc76Jeff Sharkey    }
3906c5f8a768bcd4f7b6441f7525bd5c639399fc76Jeff Sharkey}
40