ORCentral
|
00001 package eu.coform.test; 00002 00003 import static org.junit.Assert.*; 00004 00005 import org.junit.Before; 00006 import org.junit.Test; 00007 00008 import eu.coform.UniqueID; 00009 import eu.coform.command.CreateNewUUIDCommand; 00010 import eu.coform.database.DBException; 00011 import eu.coform.database.command.IntIDDBCommand; 00012 00013 public class IntIDDBCommandTest { 00014 00015 private UniqueID id; 00016 @Before 00017 public void setUp() throws Exception { 00018 CreateNewUUIDCommand com = new CreateNewUUIDCommand(); 00019 id = com.execute(); 00020 } 00021 00022 @Test 00023 public void testExec() { 00024 try { 00025 setUp(); 00026 } catch (Exception e) { 00027 // TODO Auto-generated catch block 00028 assert(false); 00029 e.printStackTrace(); 00030 } 00031 assertNotNull(id); 00032 IntIDDBCommand intcom = new IntIDDBCommand(id); 00033 try { 00034 intcom.exec(); 00035 } catch (DBException e) { 00036 // TODO Auto-generated catch block 00037 assert(false); 00038 e.printStackTrace(); 00039 } 00040 int result = intcom.getResult(); 00041 assert(result != 0); // will fail on empty database... 00042 System.out.println(result); 00043 } 00044 00045 }