A 
		
				
			
		Addie
Guest
I have a Unit Test for a class "DbCommand" which in its constructor verifies if the first parameter receives the "?" value. If it does, it throws an ArgumentException.
	
	
	
		
In the Unit Test I am assigning the first parameter with the "?" to verify that the exception is thrown. For that I added:
	
	
	
		
But the Unit test fails with the first line of the Failure trace being: "System.ArgumentException: DbConnection must be vaild"
Even though I am already expecting this? I have a few more places were I am using the exact exception and am able to get it caught in the @test header. But here it doesn't work.
Continue reading...
				
			
		Code:
	
	CONSTRUCTOR PUBLIC DbCommand (dbConnection AS DbConnection,
                              cInstruction AS CHARACTER):
    IF (dbConnection = ?) THEN
        UNDO, THROW NEW ArgumentException("DbConnection must be valid":U) .
	In the Unit Test I am assigning the first parameter with the "?" to verify that the exception is thrown. For that I added:
		Code:
	
	@Test (expect="System.ArgumentException").
METHOD PUBLIC VOID TestDbCommand ():
    DEFINE VARIABLE oDbCommand AS DbCommand NO-UNDO .
    oDbCommand = NEW DbCommand(?, "Delete") .
	But the Unit test fails with the first line of the Failure trace being: "System.ArgumentException: DbConnection must be vaild"
Even though I am already expecting this? I have a few more places were I am using the exact exception and am able to get it caught in the @test header. But here it doesn't work.
Continue reading...