Search in sources :

Example 1 with StringFormatter

use of com.globalcollect.gateway.sdk.client.android.sdk.formatter.StringFormatter in project connect-sdk-client-android by Ingenico-ePayments.

the class MaskTest method testMaskingSingleCharacterInclCursor.

@Test
public void testMaskingSingleCharacterInclCursor() {
    StringFormatter formatter = new StringFormatter();
    FormatResult maskedValue = formatter.applyMask(maskExpiryDate, maskTestString1, emptyString, 0);
    assertEquals("1", maskedValue.getFormattedResult());
    assertTrue(maskedValue.getCursorIndex() == 1);
}
Also used : StringFormatter(com.globalcollect.gateway.sdk.client.android.sdk.formatter.StringFormatter) FormatResult(com.globalcollect.gateway.sdk.client.android.sdk.model.FormatResult) Test(org.junit.Test)

Example 2 with StringFormatter

use of com.globalcollect.gateway.sdk.client.android.sdk.formatter.StringFormatter in project connect-sdk-client-android by Ingenico-ePayments.

the class MaskTest method testMaskTwoCharacters.

@Test
public void testMaskTwoCharacters() {
    StringFormatter formatter = new StringFormatter();
    String maskedValue = formatter.applyMask(maskExpiryDate, maskTestString2);
    assertEquals("12-", maskedValue);
}
Also used : StringFormatter(com.globalcollect.gateway.sdk.client.android.sdk.formatter.StringFormatter) Test(org.junit.Test)

Example 3 with StringFormatter

use of com.globalcollect.gateway.sdk.client.android.sdk.formatter.StringFormatter in project connect-sdk-client-android by Ingenico-ePayments.

the class MaskTest method testMaskSingleCharacter.

@Test
public void testMaskSingleCharacter() {
    StringFormatter formatter = new StringFormatter();
    String maskedValue = formatter.applyMask(maskExpiryDate, maskTestString1);
    assertEquals("1", maskedValue);
}
Also used : StringFormatter(com.globalcollect.gateway.sdk.client.android.sdk.formatter.StringFormatter) Test(org.junit.Test)

Example 4 with StringFormatter

use of com.globalcollect.gateway.sdk.client.android.sdk.formatter.StringFormatter in project connect-sdk-client-android by Ingenico-ePayments.

the class MaskTest method testUnmaskingSingleCharacter.

@Test
public void testUnmaskingSingleCharacter() {
    StringFormatter formatter = new StringFormatter();
    String maskedValue = formatter.removeMask(maskExpiryDate, maskTestString1);
    assertEquals("1", maskedValue);
}
Also used : StringFormatter(com.globalcollect.gateway.sdk.client.android.sdk.formatter.StringFormatter) Test(org.junit.Test)

Example 5 with StringFormatter

use of com.globalcollect.gateway.sdk.client.android.sdk.formatter.StringFormatter in project connect-sdk-client-android by Ingenico-ePayments.

the class MaskTest method testInsertCharacterInStringInclCursor.

@Test
public void testInsertCharacterInStringInclCursor() {
    StringFormatter formatter = new StringFormatter();
    FormatResult maskedValue = formatter.applyMask(maskExpiryDate, "11-22", maskTestString2, 1);
    assertEquals("11-22", maskedValue.getFormattedResult());
    assertTrue(maskedValue.getCursorIndex() == 4);
}
Also used : StringFormatter(com.globalcollect.gateway.sdk.client.android.sdk.formatter.StringFormatter) FormatResult(com.globalcollect.gateway.sdk.client.android.sdk.model.FormatResult) Test(org.junit.Test)

Aggregations

StringFormatter (com.globalcollect.gateway.sdk.client.android.sdk.formatter.StringFormatter)15 Test (org.junit.Test)12 FormatResult (com.globalcollect.gateway.sdk.client.android.sdk.model.FormatResult)6 KeyValuePair (com.globalcollect.gateway.sdk.client.android.sdk.model.paymentproduct.KeyValuePair)3 InvalidParameterException (java.security.InvalidParameterException)3 InputFilter (android.text.InputFilter)2 EditText (android.widget.EditText)2 TextView (android.widget.TextView)2 Translator (com.globalcollect.gateway.sdk.client.android.exampleapp.translation.Translator)2 PaymentItem (com.globalcollect.gateway.sdk.client.android.sdk.model.paymentproduct.PaymentItem)2 Drawable (android.graphics.drawable.Drawable)1 LayoutInflater (android.view.LayoutInflater)1 View (android.view.View)1 LayoutParams (android.view.ViewGroup.LayoutParams)1 ImageView (android.widget.ImageView)1 LinearLayout (android.widget.LinearLayout)1 AssetManager (com.globalcollect.gateway.sdk.client.android.sdk.manager.AssetManager)1 AccountOnFile (com.globalcollect.gateway.sdk.client.android.sdk.model.paymentproduct.AccountOnFile)1 AccountOnFileDisplay (com.globalcollect.gateway.sdk.client.android.sdk.model.paymentproduct.AccountOnFileDisplay)1