1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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 }