<commit_before>package io.codearte.jfairy.producer.payment

import io.codearte.jfairy.data.DataMaster
import io.codearte.jfairy.data.MapBasedDataMaster
import io.codearte.jfairy.producer.BaseProducer
import io.codearte.jfairy.producer.DateProducer
import org.joda.time.DateTime
import spock.lang.Specification

/**
 * @author <EMAIL>
 * @since 2013-11-17
 */
class CreditCardProviderSpec extends Specification {

	public static final DateTime EXPIRY_DATE = new DateTime("2009-02-11T23:59:59.999")

	private DataMaster dataMaster
	private DateProducer dateProducer
	private CreditCardProvider creditCardProvider;

	def setup() {
		dataMaster = new MapBasedDataMaster(new BaseProducer(new Random()))
		dateProducer = Mock(DateProducer)
		dataMaster.readResources("jfairy.yml")
		creditCardProvider = new CreditCardProvider(dataMaster, dateProducer)
	}

	def "should return credit card provider"() {
		when:
			CreditCard creditCard = creditCardProvider.get()
		then:
			creditCard.getVendor()
	}

	def "should return card expiry date"() {
		given:
			dateProducer.randomDateBetweenNowAndFuturePeriod(_) >> EXPIRY_DATE
		when:
			CreditCard creditCard = creditCardProvider.get()
		then:
			creditCard.getExpiryDate() == EXPIRY_DATE
	}

	def "should return card expiry date string"() {
		given:
			dateProducer.randomDateBetweenNowAndFuturePeriod(_) >> EXPIRY_DATE
		when:
			CreditCard creditCard = creditCardProvider.get()
		then:
			creditCard.getExpiryDateAsString() == "02/09"
	}


}<commit_msg>Refactor CreditCard class to java bean setters, replace groovy method calls<commit_after>package io.codearte.jfairy.producer.payment

import io.codearte.jfairy.data.DataMaster
import io.codearte.jfairy.data.MapBasedDataMaster
import io.codearte.jfairy.producer.BaseProducer
import io.codearte.jfairy.producer.DateProducer
import org.joda.time.DateTime
import spock.lang.Specification

/**
 * @author <EMAIL>
 * @since 2013-11-17
 */
class CreditCardProviderSpec extends Specification {

	public static final DateTime EXPIRY_DATE = new DateTime("2009-02-11T23:59:59.999")

	private DataMaster dataMaster
	private DateProducer dateProducer
	private CreditCardProvider creditCardProvider;

	def setup() {
		dataMaster = new MapBasedDataMaster(new BaseProducer(new Random()))
		dateProducer = Mock(DateProducer)
		dataMaster.readResources("jfairy.yml")
		creditCardProvider = new CreditCardProvider(dataMaster, dateProducer)
	}

	def "should return credit card provider"() {
		when:
			CreditCard creditCard = creditCardProvider.get()
		then:
			creditCard.vendor
	}

	def "should return card expiry date"() {
		given:
			dateProducer.randomDateBetweenNowAndFuturePeriod(_) >> EXPIRY_DATE
		when:
			CreditCard creditCard = creditCardProvider.get()
		then:
			creditCard.expiryDate == EXPIRY_DATE
	}

	def "should return card expiry date string"() {
		given:
			dateProducer.randomDateBetweenNowAndFuturePeriod(_) >> EXPIRY_DATE
		when:
			CreditCard creditCard = creditCardProvider.get()
		then:
			creditCard.expiryDateAsString == "02/09"
	}


}
{'fraction_non_alphanumeric': 0.09180651530108588, 'fraction_numerical': 0.019085225403093122, 'mean_word_length': 5.268041237113402, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6723944', 'n_tokens_mistral': 1104, 'n_tokens_neox': 965, 'n_words': 204}