Code example for Random

Methods: nextBooleannextIntnextLong

0
	private Product buildValidProduct() { 
		// Build sample product 
		Product product = new Product();
 
		// Fill attributes with dummy and random strings 
		product.setId(new Integer(new Integer(random.nextInt())));
		String randomString = Long.toString(Math.abs(random.nextLong()), 10);
		product.setDescription(randomString);
		randomString = Long.toString(Math.abs(random.nextLong()), 10);
		product.setName(randomString);
		product.setValid(random.nextBoolean());
		return product;
	} 
 
	/* 
	 * Tests CustomerDaoHash.add function In order to test ONLY CustomerDaoHash 
	 * "add" functionality, the rest of needed functions are executed directly 
	 * from the HashTable 
	 */ 
	public void testCustomerDaoHashAdd() { 
Stop searching for code, let great code find you!  Add Codota to your java IDE