### Question:
TransactionPurchasesHiddenMarkovModel implements ConditionalSampler<List<Product>, Double> { public List<Product> sample(Double transactionTime) throws Exception { int numPurchases = 0; List<Product> purchasedProducts = Lists.newArrayList(); String category; while(true) { category = this.chooseCategory(transactionTime, numPurchases); if(category.equals(STOP_STATE)) { break; } Product product = this.chooseProduct(category); purchasedProducts.add(product); this.inventory.simulatePurchase(transactionTime, product); numPurchases += 1; } return purchasedProducts; } TransactionPurchasesHiddenMarkovModel(ConditionalSampler<Product, String> purchasingProcesses,
			ConditionalWeightFunction<Double, Double> categoryWF, CustomerInventory inventory,
				SeedFactory seedFactory); List<Product> sample(Double transactionTime);  }### Answer:
@Test public void testSample() throws Exception { TransactionPurchasesHiddenMarkovModel hmm = createHMM(); List<Product> purchase = hmm.sample(1.0); assertTrue(purchase.size() > 0); for(int i = 0; i < purchase.size(); i++) { Product product = purchase.get(i); assertNotNull(product); assertTrue(product.getFieldValue(Constants.PRODUCT_CATEGORY).equals("dog food") || product.getFieldValue(Constants.PRODUCT_CATEGORY).equals("cat food")); } }