1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 package org.kuali.mobility.shared;
16
17 import org.apache.log4j.Logger;
18 import org.junit.Before;
19 import org.junit.Test;
20
21 import static org.junit.Assert.assertFalse;
22 import static org.junit.Assert.assertTrue;
23
24
25
26
27 public class LoginServiceImplTest {
28 private static final Logger LOG = Logger.getLogger(LoginServiceImplTest.class);
29
30 private LoginService service;
31
32 @Before
33 public void preTest() {
34 setService(new LoginServiceImpl());
35 }
36
37 @Test
38 public void testIsValidUser() {
39 boolean response = getService().isValidUser("mitch");
40 assertTrue("Failed to find valid user in LoginService.",response);
41 response = getService().isValidUser("yoda");
42 assertFalse("Found valid user when we should not have.",response);
43 }
44
45 @Test
46 public void testIsValidLogin() {
47 boolean response = getService().isValidLogin("mitch","fae53351b9effc708e764e871bef3119");
48 assertTrue("Failed to validate login in LoginService.",response);
49 response = getService().isValidLogin("yoda","abcdefghijklmnopqrstuvwxyz");
50 assertFalse("Found valid login for invalid user when we should not have.",response);
51 response = getService().isValidLogin("nate","abcdefghijklmnopqrstuvwxyz");
52 assertFalse("Found valid login for valid user with bad password when we should not have.",response);
53 }
54
55 public LoginService getService() {
56 return service;
57 }
58
59 public void setService(LoginService service) {
60 this.service = service;
61 }
62 }