Skip to content

Commit

Permalink
apptools: tests
Browse files Browse the repository at this point in the history
Signed-off-by: Ketoth Xupack <ketoth.xupack@gmail.com>
  • Loading branch information
KetothXupack committed Oct 23, 2013
1 parent 1a4d83b commit c621a25
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
16 changes: 14 additions & 2 deletions projects/apptools/src/test/java/org/nohope/app/AppTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public void run() {
public void asyncApp() throws Exception {
final AsyncAppExample test = new AsyncAppExample();

new Thread(new Runnable() {
final Thread thread = new Thread(new Runnable() {
@Override
public void run() {
try {
Expand All @@ -45,7 +45,9 @@ public void run() {
}
test.stop();
}
}).start();
});
thread.start();
thread.join();

test.start();
assertFalse(test.isStarted());
Expand All @@ -70,4 +72,14 @@ public void run() {
test.start();
assertFalse(test.isStarted());
}

@Test
public void hook() {
final App app = new App() {
@Override
protected void onStart() throws Exception {
}
};
app.onVMShutdown();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public class AsyncAppExample extends AsyncApp {

@Override
protected void onPlannedStop() {
super.onPlannedStop();
LOG.debug("AsyncAppExample.onPlannedStop()");
}

Expand All @@ -23,7 +24,7 @@ protected void onStart() {

@Override
protected void onVMShutdown() {
super.onVMShutdown();
LOG.debug("AsyncAppExample.onVMShutdown()");
}

}

0 comments on commit c621a25

Please sign in to comment.