| Line | Hits | Source |
|---|---|---|
| 1 | package umich.cac.util.test; | |
| 2 | ||
| 3 | import junit.framework.Test; | |
| 4 | import junit.framework.TestCase; | |
| 5 | import junit.framework.TestSuite; | |
| 6 | import umich.cac.util.Passwd; | |
| 7 | ||
| 8 | /** | |
| 9 | * Tests for Passwd class. | |
| 10 | * | |
| 11 | * @author rmach@umich.edu | |
| 12 | * | |
| 13 | */ | |
| 14 | public class PasswdTest extends TestCase { | |
| 15 | ||
| 16 | /** | |
| 17 | * Constructor | |
| 18 | * | |
| 19 | * @param testName name of test suite | |
| 20 | */ | |
| 21 | public PasswdTest(java.lang.String testName) { | |
| 22 | 3 | super(testName); |
| 23 | 3 | } |
| 24 | ||
| 25 | /** | |
| 26 | * Main - for running stand-alone test | |
| 27 | * | |
| 28 | * @param args command line arguments | |
| 29 | */ | |
| 30 | public static void main(java.lang.String[] args) { | |
| 31 | 0 | junit.textui.TestRunner.run(suite()); |
| 32 | 0 | } |
| 33 | ||
| 34 | /** | |
| 35 | * Return a new test suite | |
| 36 | * | |
| 37 | * @return a new test suite | |
| 38 | */ | |
| 39 | public static Test suite() { | |
| 40 | 6 | TestSuite suite = new TestSuite(PasswdTest.class); |
| 41 | 3 | return suite; |
| 42 | } | |
| 43 | ||
| 44 | /** | |
| 45 | * Unit test to make sure that lookupUid works correctly | |
| 46 | * give a fake password file | |
| 47 | */ | |
| 48 | public void testLookupUid() { | |
| 49 | // passwd is a fake class for testing located in testcases dir | |
| 50 | 3 | Passwd passwd = null; |
| 51 | ||
| 52 | try { | |
| 53 | 3 | passwd = new Passwd("testcases/passwd"); |
| 54 | 0 | } catch (Exception e) { |
| 55 | 0 | fail(); |
| 56 | 3 | } |
| 57 | // look me up out out of that file and make sure uid is still 28272 | |
| 58 | 3 | long uid = passwd.lookupUid("rmach"); |
| 59 | 3 | assertTrue(uid == 28272); |
| 60 | 3 | } |
| 61 | } |
|
this report was generated by version 1.0.5 of jcoverage. |
copyright © 2003, jcoverage ltd. all rights reserved. |