Recent Notes

Displaying keyword search results 1 - 3
Created by freyo on September 07, 2011 16:46:14    Last update: September 07, 2011 19:23:00
The Android unit test framework is based on JUnit 3 , not JUnit 4. Test cases have to extend junit.framework.TestCase or a subclass (such as android.test.InstrumentationTestCase ). Tests are identified by public methods whose name starts with test , not methods annotated with @Test (as in JUnit 4). An Android test suite is packaged as an APK, just like the application being tested. To create a test package, first you need to identify the application package it is testing. Google suggests to put the test package source in a directory named tests/ alongside the src/ directory of the main application. At runtime, Android instrumentation loads both the test package and the application under test into the same process. Therefore, the tests can invoke methods on...
Created by Dr. Xi on June 13, 2011 15:05:27    Last update: June 13, 2011 15:10:24
When you pass parameters from shell to Java, the list arguments may be messed up if there are spaces in the values. Start with a simple Java test class: public class EchoParams { public static voi... Tests: $ java EchoParams a b c Arg: a Arg: b Arg... Now wrap the command in a shell script ( echoparams.sh ): #!/bin/sh java EchoParams $* Tests: $ ./echoparams.sh a b c Arg: a Arg: b Arg... The quotes had no effect on the parameters list. Changing $* to $@ produces the same results. The correct way to quote the args list is: "$@" #!/bin/sh java EchoParams "$@" Test: $ ./echoparams.sh a b "c d" "1 2 3 4 5" Arg: a ...
Created by Fang on August 13, 2009 04:18:26    Last update: August 13, 2009 04:18:26
To start a simple "Hello World" project in maven, enter: mvn archetype:create -DgroupId=com.example -Dartif... in the command line. It will take a while for Maven to run. But eventually it will create the standard Maven directory structure with a "Hello World" app and a fake JUnit test. Enter mvn package will build the simple App into a jar under the target directory. Run the resulting App: C:\maven\hello-world>java -cp target\hello-world-1... This is the generated pom: <project xmlns="http://maven.apache.org/POM/4.0.0"...