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
  • Constructor Details

  • Method Details

    • creditCards

      public static CreditCards creditCards()

      Returns a CreditCards object 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 CreditCards instance. The class implements MockUnitString.
    • supplier

      public java.util.function.Supplier<java.lang.String> supplier()
      Description copied from interface: MockUnit
      This is the sole abstract method of the interface. Needs to be implemented every-time a MockUnit is implemented.
      Specified by:
      supplier in interface MockUnit<java.lang.String>
      Returns:
      A Supplier<T>.
    • names

      public MockUnitString names()
      Returns a new MockUnitString that is used to generate credit card names (not numbers). (Eg.: "Mastercard")
      Returns:
      A new MockUnitString.
    • type

      public MockUnitString type​(CreditCardType type)
      Returns a new MockUnitString that 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 new MockUnitString that 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 new MockUnitString that is used to generate credit card numbers from the given types: 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 new MockUnitString that is used to generate credit card numbers of type AMERICAN_EXPRESS.

      Note: This is a shortcut method for: mockNeat.creditCards().type(AMERICAN_EXPRESS

      Note: 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 new MockUnitString that is used to generate credit card numbers of type VISA_16.

      Note: This is a shortcut method for: mockNeat.creditCards().type(VISA_16

      Note: 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 new MockUnitString that is used to generate credit card numbers of type MASTERCARD.

      Note: This is a shortcut method for: mockNeat.creditCards().type(MASTERCARD

      Note: 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