diff --git a/sdk/src/main/java/co/omise/android/ui/ExpiryDateEditText.kt b/sdk/src/main/java/co/omise/android/ui/ExpiryDateEditText.kt index 41b7e65a1..c3b8f719a 100644 --- a/sdk/src/main/java/co/omise/android/ui/ExpiryDateEditText.kt +++ b/sdk/src/main/java/co/omise/android/ui/ExpiryDateEditText.kt @@ -9,8 +9,6 @@ import android.util.AttributeSet import co.omise.android.extensions.disableOptions import java.util.Calendar import java.util.GregorianCalendar -import java.util.regex.Matcher -import java.util.regex.Pattern /** * ExpiryDateEditText is a custom EditText for credit card expiration date field. This EditText @@ -73,9 +71,6 @@ class ExpiryDateEditText : OmiseEditText { } override fun onTextChanged(s: CharSequence, start: Int, before: Int, count: Int) { - if (s.length > MAX_CHARS || containsNonNumericOrSeparator(s)) { - return - } // On deleting if (s.length < beforeChangedText.length) { @@ -94,16 +89,6 @@ class ExpiryDateEditText : OmiseEditText { } } - private fun containsNonNumericOrSeparator(input: CharSequence): Boolean { - // Define a regular expression pattern to match non-numeric characters and DATE_SEPARATOR - val pattern: Pattern = Pattern.compile("[^0-9" + Pattern.quote(DATE_SEPARATOR) + "]") - - // Use a Matcher to find any non-numeric characters in the string - val matcher: Matcher = pattern.matcher(input) - - return matcher.find() - } - private fun setExpiryDateText(dateString: String) { removeTextChangedListener(textWatcher) diff --git a/sdk/src/sharedTest/java/co/omise/android/ui/TrueMoneyFormFragmentTest.kt b/sdk/src/sharedTest/java/co/omise/android/ui/TrueMoneyFormFragmentTest.kt index 7953e898a..8c3732328 100644 --- a/sdk/src/sharedTest/java/co/omise/android/ui/TrueMoneyFormFragmentTest.kt +++ b/sdk/src/sharedTest/java/co/omise/android/ui/TrueMoneyFormFragmentTest.kt @@ -10,7 +10,6 @@ import co.omise.android.R import co.omise.android.models.Source import org.hamcrest.CoreMatchers.not import org.junit.Before -import org.junit.Ignore import org.junit.Test import org.junit.runner.RunWith import org.mockito.kotlin.any @@ -63,7 +62,6 @@ class TrueMoneyFormFragmentTest { onView(withId(R.id.button_submit)).check(matches(not(isEnabled()))) } - @Ignore("Flaky test, it fails when run instrumented test on coverage workflow") @Test fun disableForm_disableFormWhenRequestSent() { onView(withId(R.id.edit_phone_number)).perform(typeText("0812345678"), closeSoftKeyboard()) diff --git a/sdk/src/test/java/co/omise/android/ui/ExpiryDateEditTextTest.kt b/sdk/src/test/java/co/omise/android/ui/ExpiryDateEditTextTest.kt index 4da433327..56696ce88 100644 --- a/sdk/src/test/java/co/omise/android/ui/ExpiryDateEditTextTest.kt +++ b/sdk/src/test/java/co/omise/android/ui/ExpiryDateEditTextTest.kt @@ -57,20 +57,6 @@ class ExpiryDateEditTextTest { assertEquals("12/34", editText.text.toString()) } - @Test - fun inputLengthExceedsMaxChars() { - val s = "123456" // 6 characters, assuming MAX_CHARS is 5 - s.forEach { editText.append(it.toString()) } - assertEquals("12/34", editText.text.toString()) // assuming that exceeding chars will not be appended - } - - @Test - fun inputContainsNonNumericOrSeparator() { - val s = "12ab" // 'ab' are non-numeric characters - s.forEach { editText.append(it.toString()) } - assertEquals("12/", editText.text.toString()) // assuming that non-numeric characters are not appended - } - @Test(expected = InputValidationException.EmptyInputException::class) fun validate_emptyValue() { "".forEach { editText.append(it.toString()) }