2 Replies Last post: Jan 13, 2003 8:31 PM by Carlos Costa e Silva  
Guest
Currently Being Moderated

Jan 13, 2003 7:20 PM

How to enable assert

Hello,

 

I have a project targeting 1.4.1, I checked the Project Properties box

"Enable 'assert' keyword and then restarted IntelliJ.

 

I then wrote a test program (see below) that has the following line in it:

 

assert(false) : "This should fail";

 

I ran this via IntelliJ both in 'release' and in 'debug' mode. I was

expecting to see a message in the IntelliJ output window telling me that the

assetion had failed. I did not see any such message in either release or

debug mode.

 

Is there something else that I need to do to enable assert other than simply

checking the check box and restarting IntelliJ?

 

Thanks,

 

Ted Hill

 

 

public class AssertionTestFrame extends JPanel

{

 

    public AssertionTestFrame()

    {

        System.out.println("AssertionTestFrame.AssertionTestFrame");

        assert(false) : "This should fail";

    }

 

    public static void main(String[ ] args)

    {

        JFrame frame = new JFrame("AssertionTestFrame");

 

        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

 

        frame.getContentPane( ).add(new AssertionTestFrame( ),

BorderLayout.CENTER);

        frame.setSize(400, 200);

        frame.setVisible(true);

    }

}

 

 

 

More Like This

  • Retrieving data ...