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   /*
8    * jcaptcha, the open source java framework for captcha definition and integration
9    * copyright (c)  2007 jcaptcha.net. All Rights Reserved.
10   * See the LICENSE.txt file distributed with this package.
11   */
12  
13  /*
14   * jcaptcha, the open source java framework for captcha definition and integration
15   * copyright (c)  2007 jcaptcha.net. All Rights Reserved.
16   * See the LICENSE.txt file distributed with this package.
17   */
18  
19  package com.octo.captcha.sound.spellfind;
20  
21  import junit.framework.TestCase;
22  
23  import com.octo.captcha.CaptchaException;
24  import com.octo.captcha.component.word.wordgenerator.RandomWordGenerator;
25  import com.octo.captcha.sound.WordToSoundMock;
26  import com.octo.captcha.sound.speller.SpellerSoundFactory;
27  
28  public class SpellFindCaptchaFactoryTest extends TestCase {
29  
30      public void testSpellerSoundFactory() throws Exception {
31          try {
32              new SpellerSoundFactory(null, null, null);
33              fail("Test is not implemented");
34          } catch (CaptchaException e) {
35              assertNotNull(e.getMessage());
36          }
37          try {
38              new SpellerSoundFactory(new RandomWordGenerator("a"), null, null);
39              fail("Test is not implemented");
40          } catch (CaptchaException e) {
41              assertNotNull(e.getMessage());
42          }
43  
44          try {
45              new SpellerSoundFactory(null, new WordToSoundMock(), null);
46              fail("Test is not implemented");
47          } catch (CaptchaException e) {
48              assertNotNull(e.getMessage());
49          }
50      }
51  
52  
53      public void testGetSoundCaptcha() throws Exception {
54          SpellFindCaptchaFactory tested = new SpellFindCaptchaFactory(new RandomWordGenerator("azertyuiop"), new WordToSoundMock()); 
55          assertNotNull(tested.getSoundCaptcha());
56          assertNotNull(tested.getSoundCaptcha().getChallenge());
57          assertNotNull(tested.getSoundCaptcha().getQuestion());
58      }
59  
60  }