summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorRégis Décamps <regisd@google.com>2014-08-15 17:31:30 +0200
committerRégis Décamps <regisd@google.com>2014-08-20 12:23:12 +0200
commit8ca56f676834b1b791e5fe7c382aa3e58616bc56 (patch)
tree150528ec02d50c0d95346bf4a3ff05f759993dd9 /tests
parent2e214867fd7f37d6d84aa94d363649df26652b49 (diff)
downloadandroid_packages_apps_UnifiedEmail-8ca56f676834b1b791e5fe7c382aa3e58616bc56.tar.gz
android_packages_apps_UnifiedEmail-8ca56f676834b1b791e5fe7c382aa3e58616bc56.tar.bz2
android_packages_apps_UnifiedEmail-8ca56f676834b1b791e5fe7c382aa3e58616bc56.zip
minor change of getAccountTypeForAccount in AnalyticsUtils
Rename the method from getAccountTypeForAccount into getEmailProviderForAddress because - it doesn't return a type in the sense of POP/IMAP/etc - the input isn't an accounts.Account Also, refactor to use `equals` on domain rather than `endsWith` on address. Also, canonicalize to lower case. Change-Id: I616ffb2df5300741bc147914648f80ec0fc3dccd
Diffstat (limited to 'tests')
-rw-r--r--tests/src/com/android/mail/analytics/AnalyticsUtilsTests.java32
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/src/com/android/mail/analytics/AnalyticsUtilsTests.java b/tests/src/com/android/mail/analytics/AnalyticsUtilsTests.java
new file mode 100644
index 000000000..4fe137749
--- /dev/null
+++ b/tests/src/com/android/mail/analytics/AnalyticsUtilsTests.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (C) 2014 Google Inc.
+ * Licensed to The Android Open Source Project.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *******************************************************************************/
+package com.android.mail.analytics;
+
+import android.test.AndroidTestCase;
+import android.test.suitebuilder.annotation.SmallTest;
+
+/**
+ * Tests for {@link com.android.mail.analytics.AnalyticsUtils}.
+ */
+@SmallTest
+public class AnalyticsUtilsTests extends AndroidTestCase {
+ public void testGetEmailProviderForAddress() {
+ assertEquals("gmail", AnalyticsUtils.getEmailProviderForAddress("foo@gmail.com"));
+ assertEquals("other", AnalyticsUtils.getEmailProviderForAddress("foo@example.com"));
+ assertEquals("unknown", AnalyticsUtils.getEmailProviderForAddress(null));
+ }
+}