Class CreditCards
- java.lang.Object
-
- net.andreinc.mockneat.abstraction.MockUnitBase
-
- net.andreinc.mockneat.unit.financial.CreditCards
-
- All Implemented Interfaces:
MockUnit<java.lang.String>,MockUnitString
public class CreditCards extends MockUnitBase implements MockUnitString
-
-
Field Summary
-
Fields inherited from class net.andreinc.mockneat.abstraction.MockUnitBase
mockNeat
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedCreditCards()CreditCards(MockNeat mockNeat)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description MockUnitStringamex()Returns a newMockUnitStringthat is used to generate credit card numbers of typeAMERICAN_EXPRESS.static CreditCardscreditCards()Returns aCreditCardsobject that can be used to generate valid Credit Card numbers.MockUnitStringcustom(int length, java.lang.Integer... prefix)Returns a newMockUnitStringthat is used to generate custom credit card numbers with a given length and prefix.MockUnitStringmasterCard()Returns a newMockUnitStringthat is used to generate credit card numbers of typeMASTERCARD.MockUnitStringnames()Returns a newMockUnitStringthat is used to generate credit card names (not numbers).java.util.function.Supplier<java.lang.String>supplier()This is the sole abstract method of the interface.MockUnitStringtype(CreditCardType type)Returns a newMockUnitStringthat is used to generate credit card numbers of a given type:CreditCardType.MockUnitStringtypes(CreditCardType... types)Returns a newMockUnitStringthat is used to generate credit card numbers from the giventypes:CreditCardType.MockUnitStringvisa()Returns a newMockUnitStringthat is used to generate credit card numbers of typeVISA_16.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface net.andreinc.mockneat.abstraction.MockUnit
array, array, collection, collection, collection, collection, collection, collection, consume, consume, get, get, list, list, list, list, list, list, map, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapToDouble, mapToInt, mapToLocalDate, mapToLong, mapToString, mapToString, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, serialize, set, set, set, set, set, set, stream, val, val, valStr, valStr
-
Methods inherited from interface net.andreinc.mockneat.abstraction.MockUnitString
accumulate, append, array, base64, escapeCsv, escapeEcmaScript, escapeHtml, escapeXml, format, md2, md5, noSpecialChars, prepend, replace, replace, replaceAll, replaceFirst, sha1, sha256, sha384, sha512, split, split, sub, sub, urlEncode, urlEncode
-
-
-
-
Constructor Detail
-
CreditCards
protected CreditCards()
-
CreditCards
public CreditCards(MockNeat mockNeat)
-
-
Method Detail
-
creditCards
public static CreditCards creditCards()
Returns a
CreditCardsobject that can be used to generate valid Credit Card numbers.Note: By default it generates AMERICAN_EXPRESS valid credit card numbers.
Note: Credit card numbers are financial information. The values are generated at random so don't use them in real-life scenarios.
- Returns:
- A re-usable
CreditCardsinstance. The class implementsMockUnitString.
-
supplier
public java.util.function.Supplier<java.lang.String> supplier()
Description copied from interface:MockUnitThis is the sole abstract method of the interface. Needs to be implemented every-time a MockUnit is implemented.
-
names
public MockUnitString names()
Returns a newMockUnitStringthat is used to generate credit card names (not numbers). (Eg.: "Mastercard")- Returns:
- A new
MockUnitString.
-
type
public MockUnitString type(CreditCardType type)
Returns a newMockUnitStringthat is used to generate credit card numbers of a given type:CreditCardType.Note: Credit card numbers are financial information. The values are generated at random so don't use them in real-life scenarios.
- Parameters:
type- The type of the generated credit card number.- Returns:
- A new
MockUnitString
-
custom
public MockUnitString custom(int length, java.lang.Integer... prefix)
Returns a newMockUnitStringthat is used to generate custom credit card numbers with a given length and prefix.Note: Credit card numbers are financial information. The values are generated at random so don't use them in real-life scenarios.
- Parameters:
length- The length of the credit card number.prefix- The prefix- Returns:
- A new
MockUnitString
-
types
public MockUnitString types(CreditCardType... types)
Returns a newMockUnitStringthat is used to generate credit card numbers from the giventypes:CreditCardType.Note: Credit card numbers are financial information. The values are generated at random so don't use them in real-life scenarios.
- Parameters:
types- A var-arg array that contains the types of the desired credit card numbers.- Returns:
- A new
MockUnitString
-
amex
public MockUnitString amex()
Returns a newMockUnitStringthat is used to generate credit card numbers of typeAMERICAN_EXPRESS.Note: This is a shortcut method for:
mockNeat.creditCards().type(AMERICAN_EXPRESSNote: Credit card numbers are financial information. The values are generated at random so don't use them in real-life scenarios.
- Returns:
- A new
MockUnitString.
-
visa
public MockUnitString visa()
Returns a newMockUnitStringthat is used to generate credit card numbers of typeVISA_16.Note: This is a shortcut method for:
mockNeat.creditCards().type(VISA_16Note: Credit card numbers are financial information. The values are generated at random so don't use them in real-life scenarios.
- Returns:
- A new
MockUnitString.
-
masterCard
public MockUnitString masterCard()
Returns a newMockUnitStringthat is used to generate credit card numbers of typeMASTERCARD.Note: This is a shortcut method for:
mockNeat.creditCards().type(MASTERCARDNote: Credit card numbers are financial information. The values are generated at random so don't use them in real-life scenarios.
- Returns:
- A new
MockUnitString
-
-