View Javadoc

1   /*
2    * JCaptcha, the open source java framework for captcha definition and integration
3    * Copyright (c)  2007 jcaptcha.net. All Rights Reserved.
4    * See the LICENSE.txt file distributed with this package.
5    */
6   
7   package com.octo.captcha.service.captchastore;
8   
9   
10  /***
11   * @author <a href="mailto:antoine.veret@gmail.com">Antoine Véret</a>
12   * @version 1.0
13   */
14  public class JBossCacheCaptchaStoreTest extends CaptchaStoreTestAbstract {
15  
16  	/* (non-Javadoc)
17  	 * @see com.octo.captcha.service.captchastore.CaptchaStoreTestAbstract#getStore()
18  	 */
19  	public CaptchaStore getStore() {
20  		return new JBossCacheCaptchaStore();
21  	}
22  	
23      public void setUp() throws Exception {
24      	System.setProperty(JBossCacheCaptchaStore.JCAPTCHA_JBOSSCACHE_CONFIG, "captchaStoreJBossCache.xml");
25      	super.setUp();                
26      }
27      
28      public void tearDown() {
29          super.tearDown();      
30      }
31      
32      public void testSystemPropertyForConfig() throws Exception {
33          System.clearProperty(JBossCacheCaptchaStore.JCAPTCHA_JBOSSCACHE_CONFIG);
34          
35          store.cleanAndShutdown();
36          
37          try {
38              store.initAndStart();
39              fail();
40          } catch (RuntimeException e) {
41              assertEquals("The system property " + JBossCacheCaptchaStore.JCAPTCHA_JBOSSCACHE_CONFIG +
42                      " have to be set", e.getMessage());
43          }
44      }
45  
46  }