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  package com.octo.captcha.sound.speller;
19  
20  import com.octo.captcha.CaptchaException;
21  import com.octo.captcha.component.word.worddecorator.SpellerWordDecorator;
22  import com.octo.captcha.component.word.wordgenerator.RandomWordGenerator;
23  import com.octo.captcha.sound.WordToSoundMock;
24  import junit.framework.TestCase;
25  
26  public class SpellerSoundFactoryTest extends TestCase {
27  
28        public void testSpellerSoundFactory() throws Exception {
29            try {
30                new SpellerSoundFactory(null, null, null);
31                fail("Test is not implemented");
32            } catch (CaptchaException e) {
33                assertNotNull(e.getMessage());
34            }
35            try {
36                new SpellerSoundFactory(new RandomWordGenerator("a"), null, null);
37                fail("Test is not implemented");
38            } catch (CaptchaException e) {
39                assertNotNull(e.getMessage());
40            }
41  
42            try {
43                new SpellerSoundFactory(null, new WordToSoundMock(), null);
44                fail("Test is not implemented");
45            } catch (CaptchaException e) {
46                assertNotNull(e.getMessage());
47            }
48        }
49  
50  
51      public void testGetSoundCaptcha() throws Exception {
52          SpellerSoundFactory tested = new SpellerSoundFactory(new RandomWordGenerator("a"), new WordToSoundMock(), new SpellerWordDecorator(";"));
53          assertNotNull(tested.getSoundCaptcha());
54          assertNotNull(tested.getSoundCaptcha().getChallenge());
55          assertNotNull(tested.getSoundCaptcha().getQuestion());
56      }
57  }