public void memoryShortageTest() throws InterruptedException, ExecutionException {
		logger.info("memory shortage test");
		final AtomicInteger id = new AtomicInteger();
		long maxMemory = Runtime.getRuntime().maxMemory();
		final int weight = (int) (maxMemory  / cacheSize) ;
		final long start = System.currentTimeMillis();
		final int minutes = 1;
		ExecutorService threadPool = Executors.newFixedThreadPool(NUM_OF_THREADS);
		List<Future<Boolean>> results = new ArrayList<Future<Boolean>>();
		for (int i = 0; i < NUM_OF_THREADS; i++){
			Future<Boolean> result = threadPool.submit(new Callable<Boolean>(){			
				@Override
				public Boolean call() {
					boolean ans = false;
					int i = 0;
					while(System.currentTimeMillis() - start < TimeUnit.MINUTES.toMillis(minutes)){
						try{
							i++;
							Medal toWrite;	
							if(i % 3 == 0)
								toWrite = new GoldMedal(id.incrementAndGet());
							else if (i % 3 == 1)
								toWrite = new SilverMedal(id.incrementAndGet());
							else
								toWrite = new BronzeMedal(id.incrementAndGet());
							toWrite.setWeight(new Payload(i, weight));
							gigaSpace.write(toWrite);
						}
						catch(SpaceMemoryShortageException e){
							ans = true;
							continue;
						}
					}
					return ans;					
				}
			});
			results.add(result);
		}
		threadPool.shutdown();
		threadPool.awaitTermination(minutes, TimeUnit.MINUTES);
		boolean gotShortage = false;
		Iterator<Future<Boolean>> iterator = results.iterator();
		while (iterator.hasNext() && !gotShortage) {
			gotShortage |= iterator.next().get();
		}
		Assert.assertTrue("did not get memory shortage", gotShortage);
		try{
			assertMemoryShortageTest();
		}
		catch(SpaceMemoryShortageException e){}
	}