ContractGenerator { public Contract generatePreMadeContract() { premadeContracts = new ArrayList<Contract>(); amount = randomAmount(); cropType = randomCrop(); repeatCount = randomRepeats(); interval = (int) (Math.random()*7 + 1); expiryDate = (int) (Math.random()*7 + 1); reward = randomReward(); penalty = randomPenalty(); Contract decoWorthsContract = new Contract("DecoWorths", cropType, amount, repeatCount, interval, reward, penalty, "We have lots of money. We want to make more. " + "Don't care if it is fresh", expiryDate); premadeContracts.add(decoWorthsContract); Contract bill = new Contract("Billy Bill ", cropType, amount, repeatCount, interval, reward, penalty, "I've heard you have bills to pay." + "Let me help you.", expiryDate); premadeContracts.add(bill); Contract george = new Contract("George", cropType, amount, repeatCount, interval, reward, penalty, "Bring me lots of crops, as many as I kill in my books", expiryDate); premadeContracts.add(george); Contract mum = new Contract("DecoWorths", cropType, amount, repeatCount, interval, reward, penalty, "Darling, please bring mummy some food, I'm starving", expiryDate); premadeContracts.add(mum); Contract todd = new Contract("Todd Ingrim", cropType, amount, repeatCount, interval, reward, penalty, "Basically, Being Vegan makes you better than " + "most people. Bingo!", expiryDate); premadeContracts.add(todd); Contract sasha = new Contract("Potato Girl", cropType, amount, repeatCount, interval, reward, penalty, "I need potatoes, they need to be fresh.", expiryDate); premadeContracts.add(sasha); Contract cabbage = new Contract("Cabbage Merchant", cropType, amount, repeatCount, interval, reward, penalty, "Some bozo destroyed my cabbages again, " + "I'll need some more", expiryDate); premadeContracts.add(cabbage); int rand = (int) (Math.random() * premadeContracts.size()); return premadeContracts.get(rand); } ContractGenerator(); Contract generatePreMadeContract();  }
@Test public void test() { Contract c = contractGenerator.generatePreMadeContract(); assertNotNull(c); assertNotNull(c.getContractGiver()); assertNotNull(c.getResourceType()); assertTrue(c.getAmount() > 0); assertTrue(c.getRepeatCount() > 0); assertTrue(c.getInterval() > 0); assertTrue(c.getReward() >= 0); assertTrue(c.getPenalty() >= 0); assertNotNull(c.getDescription()); assertTrue(c.getExpiryDate() > 0); }