@Test public void getValidDateFields_whenDataIsValid_returnsExpectedValues() { assertTrue(Calendar.getInstance().get(Calendar.YEAR) < 2050); mExpiryDateEditText.append("12"); mExpiryDateEditText.append("50"); int [] retrievedDate = mExpiryDateEditText.getValidDateFields(); assertNotNull(retrievedDate); assertEquals(12, retrievedDate[0]); assertEquals(2050, retrievedDate[1]); }
@Nullable @Size(2) public int[] getValidDateFields() { if (!mIsDateValid) { return null; } int [] monthYearPair = new int[2]; String rawNumericInput = getText().toString().replaceAll("/", ""); String[] dateFields = DateUtils.separateDateStringParts(rawNumericInput); try { monthYearPair[0] = Integer.parseInt(dateFields[0]); monthYearPair[1] = DateUtils.convertTwoDigitYearToFour(Integer.parseInt(dateFields[1])); } catch (NumberFormatException numEx) { return null; } return monthYearPair; }
ExpiryDateEditText extends StripeEditText { @Nullable @Size(2) public int[] getValidDateFields() { if (!mIsDateValid) { return null; } int [] monthYearPair = new int[2]; String rawNumericInput = getText().toString().replaceAll("/", ""); String[] dateFields = DateUtils.separateDateStringParts(rawNumericInput); try { monthYearPair[0] = Integer.parseInt(dateFields[0]); monthYearPair[1] = DateUtils.convertTwoDigitYearToFour(Integer.parseInt(dateFields[1])); } catch (NumberFormatException numEx) { return null; } return monthYearPair; } }
ExpiryDateEditText extends StripeEditText { @Nullable @Size(2) public int[] getValidDateFields() { if (!mIsDateValid) { return null; } int [] monthYearPair = new int[2]; String rawNumericInput = getText().toString().replaceAll("/", ""); String[] dateFields = DateUtils.separateDateStringParts(rawNumericInput); try { monthYearPair[0] = Integer.parseInt(dateFields[0]); monthYearPair[1] = DateUtils.convertTwoDigitYearToFour(Integer.parseInt(dateFields[1])); } catch (NumberFormatException numEx) { return null; } return monthYearPair; } ExpiryDateEditText(Context context);  ExpiryDateEditText(Context context, AttributeSet attrs);  ExpiryDateEditText(Context context, AttributeSet attrs, int defStyleAttr); }
ExpiryDateEditText extends StripeEditText { @Nullable @Size(2) public int[] getValidDateFields() { if (!mIsDateValid) { return null; } int [] monthYearPair = new int[2]; String rawNumericInput = getText().toString().replaceAll("/", ""); String[] dateFields = DateUtils.separateDateStringParts(rawNumericInput); try { monthYearPair[0] = Integer.parseInt(dateFields[0]); monthYearPair[1] = DateUtils.convertTwoDigitYearToFour(Integer.parseInt(dateFields[1])); } catch (NumberFormatException numEx) { return null; } return monthYearPair; } ExpiryDateEditText(Context context);  ExpiryDateEditText(Context context, AttributeSet attrs);  ExpiryDateEditText(Context context, AttributeSet attrs, int defStyleAttr); boolean isDateValid(); @Nullable @Size(2) int[] getValidDateFields(); void setExpiryDateEditListener(ExpiryDateEditListener expiryDateEditListener); }
ExpiryDateEditText extends StripeEditText { @Nullable @Size(2) public int[] getValidDateFields() { if (!mIsDateValid) { return null; } int [] monthYearPair = new int[2]; String rawNumericInput = getText().toString().replaceAll("/", ""); String[] dateFields = DateUtils.separateDateStringParts(rawNumericInput); try { monthYearPair[0] = Integer.parseInt(dateFields[0]); monthYearPair[1] = DateUtils.convertTwoDigitYearToFour(Integer.parseInt(dateFields[1])); } catch (NumberFormatException numEx) { return null; } return monthYearPair; } ExpiryDateEditText(Context context);  ExpiryDateEditText(Context context, AttributeSet attrs);  ExpiryDateEditText(Context context, AttributeSet attrs, int defStyleAttr); boolean isDateValid(); @Nullable @Size(2) int[] getValidDateFields(); void setExpiryDateEditListener(ExpiryDateEditListener expiryDateEditListener);  }