Menu

New assertion "not-exception"

Sujit Pal
2005-05-16
2013-04-25
  • Sujit Pal

    Sujit Pal - 2005-05-16

    Hi Meghanath,

    Moving this off to a new thread since the "executing the SQL statement" was getting cluttered with too many issues.

    I have added a new assertion "not-exception" which checks to see if the actual result is an exception. To check whether a SQL failed, you can use this to check instead of assert="none". Here are the files you will need to download and rebuild the sqlunit jar file.
    Checking in src/net/sourceforge/sqlunit/Assertions.java;
    /cvsroot/sqlunit/sqlunit/src/net/sourceforge/sqlunit/Assertions.java,v  <--  Assertions.java
    new revision: 1.19; previous revision: 1.18
    done
    Checking in src/net/sourceforge/sqlunit/beans/DatabaseResult.java;
    /cvsroot/sqlunit/sqlunit/src/net/sourceforge/sqlunit/beans/DatabaseResult.java,v  <--  DatabaseResult.java
    new revision: 1.8; previous revision: 1.7
    done
    Checking in test/mock/assertiontests.xml;
    /cvsroot/sqlunit/sqlunit/test/mock/assertiontests.xml,v  <--  assertiontests.xmlnew revision: 1.9; previous revision: 1.8
    done

    -sujit

     
    • NLTC

      NLTC - 2005-05-17

      Hi Sujit

      I am getting error as above assertion not supported.

      run-postgres-test:
        [sqlunit] *** Running SQLUnit file: sam1.xml
        [sqlunit] Getting connection(DEFAULT)
        [sqlunit] Setting up test...
        [sqlunit] Running test[1]: ADD/CVD Detail (0ms)
        [sqlunit] Assertion "not-exception" is not supported
        [sqlunit] Tearing down test...
        [sqlunit] sqlunit-ant: SQLUnit Tests Failed: In file: sam1.xml, tests: 1, fail
      ures: 1, errors = 0
        [sqlunit] One or more SQLUnit Tests failed, see the console for details

      BUILD SUCCESSFUL

      Thanks
      Meghanath

       
      • Sujit Pal

        Sujit Pal - 2005-05-17

        classpath? make sure your old sqlunit-xx.jar is not in the way.

        -sujit

         
    • NLTC

      NLTC - 2005-05-18

      Hi Sujit

      I think the old SQLUnit jars are not on the classpath.

      I am extracting all the source code from the CVS and making a new build.
      I am renaming the folders of the previous versions of the SQLUnit.

      In the present lib folder , I can see sqlunit-4.7.jar and this is in the classpath

      Thanks
      Meghanath

       
    • Sujit Pal

      Sujit Pal - 2005-05-19

      Hi Meghanath,

      OK, the sqlunit-4.7 jar file is being seen before whatever jar you are building. If you remember, we did not release the not-exception assertion with sqlunit 4.7. You can remove the sqlunit-4.7 jar and that should do it for you.

      BTW, not sure how you are rebuilding sqlunit locally. I am thinking that you are simply doing:
      ant clean compile

      You should be doing:
      ant install
      this will overwrite the sqlunit-4.7.jar file in your lib/ directory with the jar that is built from the current java files. This is described in excrutiating detail in the user guide.

      The good thing about this is that now you can now copy the sqlunit-xx.jar file to some other location in your classpath and have your application access that through your own build files.

      -sujit

       
    • NLTC

      NLTC - 2005-05-19

      Hi Sujit

      I made the new build as per the instructions in the user guide only.

      ant install

      Thanks
      Meghanath

       
      • Sujit Pal

        Sujit Pal - 2005-05-19

        Hi Meghanath,

        It definitely looks like a problem with your environment, since:
        [a] I verified that the Assertions.java was checked in three days ago (version 1.19) from the web cvs view.
        [b] The assertion works without problems in my mock tests. I agree that mock tests may not be ideal, but it will catch the error you mentioned.

        The error message looks like you may have a version of Assertions.java which /did not/ contain the not-exception assertion. You may want to check that you do, and if not, download the latest copy of everything from cvs (cvs update -dAP). That should be the absolute latest, since I havent committed since then, and the public servers should have caught up.

        You may also want to check your classpath and see if you have any other versions lying around.

        You may also be able to get some more information by running ant with verbose option, which should tell you about what class files are being accessed, although I am not too sure about this.

        I could try walking you through the local build, if you tell me exactly what commands you used to do it. Also tell me the version of Assertions.java.

        If all the above fail, then you should probably wait for the next release, which should be out once I am done with the tool you asked for.

        -sujit

         

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.