2 * Copyright (C) 2008 The Android Open Source Project
4 * Licensed under the Eclipse Public License, Version 1.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.eclipse.org/org/documents/epl-v10.php
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 package com.android.ide.eclipse.adt.internal.editors.resources.configurations;
19 import com.android.ide.eclipse.adt.internal.resources.configurations.CountryCodeQualifier;
20 import com.android.ide.eclipse.adt.internal.resources.configurations.FolderConfiguration;
22 import junit.framework.TestCase;
24 public class CountryCodeQualifierTest extends TestCase {
26 private CountryCodeQualifier mccq;
27 private FolderConfiguration config;
30 protected void setUp() throws Exception {
32 mccq = new CountryCodeQualifier();
33 config = new FolderConfiguration();
37 protected void tearDown() throws Exception {
43 public void testCheckAndSet() {
44 assertEquals(true, mccq.checkAndSet("mcc123", config));//$NON-NLS-1$
45 assertTrue(config.getCountryCodeQualifier() != null);
46 assertEquals(123, config.getCountryCodeQualifier().getCode());
47 assertEquals("mcc123", config.getCountryCodeQualifier().toString()); //$NON-NLS-1$
50 public void testFailures() {
51 assertEquals(false, mccq.checkAndSet("", config));//$NON-NLS-1$
52 assertEquals(false, mccq.checkAndSet("mcc", config));//$NON-NLS-1$
53 assertEquals(false, mccq.checkAndSet("MCC123", config));//$NON-NLS-1$
54 assertEquals(false, mccq.checkAndSet("123", config));//$NON-NLS-1$
55 assertEquals(false, mccq.checkAndSet("mccsdf", config));//$NON-NLS-1$