1 20 21 package com.methodhead.reg; 22 23 import java.util.*; 24 import java.sql.*; 25 import java.io.*; 26 import junit.framework.*; 27 import org.apache.log4j.*; 28 import com.methodhead.persistable.*; 29 import com.methodhead.test.*; 30 31 public class ContactTest extends TestCase { 32 33 Contact contact = null; 34 35 static { 36 TestUtils.initLogger(); 37 TestUtils.initDb(); 38 } 39 40 public ContactTest( String name ) { 41 super( name ); 42 } 43 44 protected void setUp() { 45 try { 46 ConnectionSingleton.runBatchUpdate( new FileReader( "webapp/WEB-INF/db/transfer-reset.sql" ) ); 47 } 48 catch ( Exception e ) { 49 fail( e.getMessage() ); 50 } 51 } 52 53 protected void tearDown() { 54 } 55 56 public void testGetFullName() { 57 contact = new Contact(); 58 59 assertEquals( "[Missing Name]", contact.getFullName() ); 63 64 contact.setString( "firstname", "First" ); 68 assertEquals( "First", contact.getFullName() ); 69 70 contact.setString( "lastname", "Last" ); 74 assertEquals( "Last, First", contact.getFullName() ); 75 76 contact.setString( "firstname", "" ); 80 assertEquals( "Last", contact.getFullName() ); 81 } 82 } 83 | Popular Tags |