1 37 package net.sourceforge.cruisecontrol.sourcecontrols; 38 39 import java.io.IOException ; 40 import java.util.Date ; 41 import java.util.List ; 42 43 import junit.framework.TestCase; 44 import net.sourceforge.cruisecontrol.Modification; 45 46 public class AlwaysBuildTest extends TestCase { 47 48 public AlwaysBuildTest(String name) { 49 super(name); 50 } 51 52 public void testDefaultUserName() throws IOException { 53 AlwaysBuild alwaysBuild = new AlwaysBuild(); 54 checkUserName("User", alwaysBuild); 55 } 56 57 public void testProvidedUserName() throws IOException { 58 AlwaysBuild alwaysBuild = new AlwaysBuild(); 59 alwaysBuild.setUserName("epugh"); 60 checkUserName("epugh", alwaysBuild); 61 62 alwaysBuild.setUserName(""); 63 checkUserName("", alwaysBuild); 64 } 65 66 private void checkUserName(String userName, AlwaysBuild alwaysBuild) { 67 List modifications = alwaysBuild.getModifications(new Date (), new Date ()); 68 assertEquals(1, modifications.size()); 69 Modification modification = (Modification) modifications.get(0); 70 assertEquals(userName, modification.userName); 71 } 72 } 73 | Popular Tags |