@@ -0,0 +1,2638 @@
+package com.wildcard.pair.model.product;%0A%0Aimport com.wildcard.pair.model.CardBuilderException;%0Aimport com.wildcard.pair.util.DummyOffer;%0Aimport org.junit.Before;%0Aimport org.junit.Test;%0A%0Aimport java.text.ParseException;%0Aimport java.util.ArrayList;%0Aimport java.util.HashMap;%0Aimport java.util.List;%0Aimport java.util.Map;%0A%0Aimport static org.junit.Assert.assertEquals;%0A%0A/**%0A * Created by michaelgarate on 7/1/14.%0A */%0Apublic class OfferBuilderValidationTest %7B%0A    DummyOffer dummyOffer;%0A%0A    @Before%0A    public void setUp() throws ParseException %7B%0A        dummyOffer = new DummyOffer();%0A    %7D%0A%0A    @Test%0A    public void isValidWithAttributes()%7B%0A        OfferBuilder builder = new OfferBuilder(dummyOffer.price);%0A        Offer offer = builder.build();%0A%0A        assertEquals(%22Price should match%22, dummyOffer.price, offer.getPrice());%0A        assertEquals(%22Number of errors should match%22, 0, builder.getErrors().size());%0A    %7D%0A%0A    @Test(expected = CardBuilderException.class)%0A    public void isInvalidWithNegativePrice()%7B%0A        OfferBuilder builder = new OfferBuilder(-12.99f);%0A    %7D%0A%0A    @Test(expected = CardBuilderException.class)%0A    public void isInvalidWithNullPrice()%7B%0A        Map%3CInteger, Float%3E emptyMap = new HashMap%3CInteger, Float%3E();%0A        Float productPrice = emptyMap.get(0);%0A%0A        OfferBuilder builder = new OfferBuilder(productPrice);%0A    %7D%0A%0A    @Test%0A    public void hasErrorForEmptyWeightunitsString()%7B%0A        OfferBuilder builder = new OfferBuilder(dummyOffer.price);%0A        builder.weightUnits(%22%22);%0A        assertEquals(%22Number of errors should match%22, 1, builder.getErrors().size());%0A    %7D%0A%0A    @Test%0A    public void hasErrorForNegativeWeight()%7B%0A        OfferBuilder builder = new OfferBuilder(dummyOffer.price);%0A        builder.weight(-50f);%0A%0A        assertEquals(%22Number of errors should match%22, 1, builder.getErrors().size());%0A    %7D%0A%0A    @Test%0A    public void hasErrorForNullGeographicAvailability()%7B%0A        OfferBuilder builder = new OfferBuilder(dummyOffer.price);%0A        builder.geographicAvailability(null);%0A        assertEquals(%22Number of errors should match%22, 1, builder.getErrors().size());%0A    %7D%0A%0A    @Test%0A    public void hasErrorForNegativeQuantity()%7B%0A        OfferBuilder builder = new OfferBuilder(dummyOffer.price);%0A        builder.quantity(-5);%0A        assertEquals(%22Number of errors should match%22, 1, builder.getErrors().size());%0A    %7D%0A%0A    @Test%0A    public void hasErrorForEmptyDescriptionString()%7B%0A        OfferBuilder builder = new OfferBuilder(dummyOffer.price);%0A        builder.description(%22%22);%0A        assertEquals(%22Number of errors should match%22, 1, builder.getErrors().size());%0A    %7D%0A%0A%0A%7D%0A

add offerbuilder validation test