Bug 1230781 - Remove obsolete TestFxAccountAgeLockoutHelper. r=me
authorNick Alexander <nalexander@mozilla.com>
Sat, 05 Dec 2015 17:46:58 -0800
changeset 275854 d0c607c9de0b75f3d2e968f99b9c03539ac8156c
parent 275853 7fb27cc3a41695df71c52db2bf093fdf8cdb43be
child 275855 0e63fa8c500d5d38070dabf8f8adeba56aa76a93
push id68956
push usercbook@mozilla.com
push dateMon, 07 Dec 2015 13:50:59 +0000
treeherdermozilla-inbound@1009be1b37ec [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersme
bugs1230781
milestone45.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1230781 - Remove obsolete TestFxAccountAgeLockoutHelper. r=me
mobile/android/tests/background/junit4/src/org/mozilla/gecko/background/fxa/test/TestFxAccountAgeLockoutHelper.java
deleted file mode 100644
--- a/mobile/android/tests/background/junit4/src/org/mozilla/gecko/background/fxa/test/TestFxAccountAgeLockoutHelper.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
-   http://creativecommons.org/publicdomain/zero/1.0/ */
-
-package org.mozilla.gecko.background.fxa.test;
-
-import org.junit.Assert;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mozilla.gecko.background.fxa.FxAccountAgeLockoutHelper;
-import org.mozilla.gecko.background.testhelpers.TestRunner;
-import org.mozilla.gecko.fxa.FxAccountConstants;
-
-import java.util.Calendar;
-
-@RunWith(TestRunner.class)
-public class TestFxAccountAgeLockoutHelper {
-  @Test
-  public void testPassesAgeCheck() {
-    Calendar today = Calendar.getInstance();
-    int birthMonthIndex = today.get(Calendar.MONTH);
-    int birthDate = today.get(Calendar.DATE);
-    int birthYear = today.get(Calendar.YEAR) - FxAccountConstants.MINIMUM_AGE_TO_CREATE_AN_ACCOUNT;
-    Assert.assertTrue("Minimum age as of today",
-        FxAccountAgeLockoutHelper.passesAgeCheck(birthDate, birthMonthIndex, birthYear));
-
-    Calendar yesterday = Calendar.getInstance();
-    yesterday.add(Calendar.DATE, -1);
-    birthMonthIndex = yesterday.get(Calendar.MONTH);
-    birthDate = yesterday.get(Calendar.DATE);
-    birthYear = yesterday.get(Calendar.YEAR) - FxAccountConstants.MINIMUM_AGE_TO_CREATE_AN_ACCOUNT;
-    Assert.assertTrue("Minimum age more than by a day",
-        FxAccountAgeLockoutHelper.passesAgeCheck(birthDate, birthMonthIndex, birthYear));
-
-    Calendar tomorrow = Calendar.getInstance();
-    tomorrow.add(Calendar.DATE, 1);
-    birthMonthIndex = tomorrow.get(Calendar.MONTH);
-    birthDate = tomorrow.get(Calendar.DATE);
-    birthYear = tomorrow.get(Calendar.YEAR) - FxAccountConstants.MINIMUM_AGE_TO_CREATE_AN_ACCOUNT;
-    Assert.assertFalse("Minimum age fails by a day",
-        FxAccountAgeLockoutHelper.passesAgeCheck(birthDate, birthMonthIndex, birthYear));
-
-    Calendar monthBefore = Calendar.getInstance();
-    monthBefore.add(Calendar.MONTH, -1);
-    birthMonthIndex = monthBefore.get(Calendar.MONTH);
-    birthDate = monthBefore.get(Calendar.DATE);
-    birthYear = monthBefore.get(Calendar.YEAR) - FxAccountConstants.MINIMUM_AGE_TO_CREATE_AN_ACCOUNT;
-    Assert.assertTrue("Minimum age more than by a month",
-        FxAccountAgeLockoutHelper.passesAgeCheck(birthDate, birthMonthIndex, birthYear));
-
-    Calendar monthAfter = Calendar.getInstance();
-    monthAfter.add(Calendar.MONTH, 1);
-    birthMonthIndex = monthAfter.get(Calendar.MONTH);
-    birthDate = monthAfter.get(Calendar.DATE);
-    birthYear = monthAfter.get(Calendar.YEAR) - FxAccountConstants.MINIMUM_AGE_TO_CREATE_AN_ACCOUNT;
-    Assert.assertFalse("Minimum age fails by a month",
-        FxAccountAgeLockoutHelper.passesAgeCheck(birthDate, birthMonthIndex, birthYear));
-  }
-
-  @Test
-  public void testIsMagicYear() {
-    final Calendar today = Calendar.getInstance();
-    int magicYear = today.get(Calendar.YEAR) - FxAccountConstants.MINIMUM_AGE_TO_CREATE_AN_ACCOUNT;
-    Assert.assertTrue("Passes magic year check: year is magic year",
-        FxAccountAgeLockoutHelper.isMagicYear(magicYear));
-
-    int beforeMagicYear = today.get(Calendar.YEAR) - FxAccountConstants.MINIMUM_AGE_TO_CREATE_AN_ACCOUNT - 1;
-    Assert.assertFalse("Fails magic year check: year before magic year",
-        FxAccountAgeLockoutHelper.isMagicYear(beforeMagicYear));
-
-    int afterMagicYear = today.get(Calendar.YEAR) - FxAccountConstants.MINIMUM_AGE_TO_CREATE_AN_ACCOUNT + 1;
-    Assert.assertFalse("Fails magic year: year after magic year",
-        FxAccountAgeLockoutHelper.isMagicYear(afterMagicYear));
-  }
-}