Package com.vtence.tape.testmodel.builders

Source Code of com.vtence.tape.testmodel.builders.CreditCardDetailsBuilder

package com.vtence.tape.testmodel.builders;

import com.vtence.tape.testmodel.CreditCardDetails;
import com.vtence.tape.testmodel.CreditCardType;

public class CreditCardDetailsBuilder implements Builder<CreditCardDetails> {

    private CreditCardType cardType = CreditCardType.visa;
    private String cardNumber;
    private String cardExpiryDate;

    public static CreditCardDetailsBuilder aVisa() {
        return aCreditCard().ofType(CreditCardType.visa);
    }

    public static CreditCardDetailsBuilder aCreditCard() {
        return new CreditCardDetailsBuilder();
    }

    public CreditCardDetailsBuilder ofType(CreditCardType type) {
        this.cardType = type;
        return this;
    }

    public CreditCardDetailsBuilder withNumber(String cardNumber) {
        this.cardNumber = cardNumber;
        return this;
    }

    public CreditCardDetailsBuilder withExpiryDate(String cardExpiryDate) {
        this.cardExpiryDate = cardExpiryDate;
        return this;
    }

    public CreditCardDetails build() {
        return new CreditCardDetails(cardType, cardNumber, cardExpiryDate);
    }
}
TOP

Related Classes of com.vtence.tape.testmodel.builders.CreditCardDetailsBuilder

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.