001    package org.hackystat.utilities.home;
002    
003    import static org.junit.Assert.assertEquals;
004    
005    import java.io.File;
006    import org.junit.Test;
007    
008    /**
009     * Tests the HackystatUserHome class.
010     * 
011     * @author Philip Johnson
012     */
013    
014    public class TestHackystatUserHome {
015    
016      /**
017       * Tests the hackystat user home definition facility.
018       * 
019       */
020      @Test
021      public void testHome() {
022        String hackystatUserHome = System.getProperty("hackystat.user.home");
023        File home = HackystatUserHome.getHome();
024        
025        if (hackystatUserHome == null) {
026          File userHomeFile = new File(System.getProperty("user.home"));
027          assertEquals ("Checking default home", userHomeFile, home);
028        }
029        else {
030          File userHomeFile = new File(System.getProperty("hackystat.user.home"));
031          assertEquals ("Checking overridden home", userHomeFile, home);
032          
033        }
034      }
035    }