I want to use the assert keyword in my android apps to destroy my app in some cases on the emulator, or my device during testing. Is this possible?
It seems that the emulator just ignores my asserts.
I want to use the assert keyword in my android apps to destroy my app in some cases on the emulator, or my device during testing. Is this possible?
It seems that the emulator just ignores my asserts.
Reading http://groups.google.com/group/android-beginners/browse_thread/thread/3dbc03300ab5ed60 seems to show that people are having difficulties with assertions with the emulator.
The API provides the JUnit Assert.
You can do
import static junit.framework.Assert.*;
now you can use all the functions like assertTrue, assertEquals, assertNull that are provided in the junit framework.
Be careful not to import the Junit4 framework through eclipse, that would be the org.junit package. You have to use the junit.framework package to get it working on an android device or the emulator.