X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=test%2Fjalview%2Futil%2Fdialogrunner%2FDialogRunnerTest.java;h=7d7e5e86ffffd27a1a4233207706bf667ef45c59;hb=a4aa14220a6a53391ca8e171bc774cef908057a3;hp=e69ae878acac372995879bafb6da6b1f4e09969d;hpb=d5bc056b7dff2e83166c0a25df7d52082954297a;p=jalview.git diff --git a/test/jalview/util/dialogrunner/DialogRunnerTest.java b/test/jalview/util/dialogrunner/DialogRunnerTest.java index e69ae87..7d7e5e8 100644 --- a/test/jalview/util/dialogrunner/DialogRunnerTest.java +++ b/test/jalview/util/dialogrunner/DialogRunnerTest.java @@ -7,18 +7,24 @@ public class DialogRunnerTest { public class MockDialog implements DialogRunnerI { - DialogRunner runner = new DialogRunner<>(this); + DialogRunnerI runner = new DialogRunner(); @Override - public MockDialog response(RunResponse action) + public DialogRunnerI addResponse(RunResponse action) { - return runner.response(action); + return runner.addResponse(action); } public void doDialog(String resp) { - runner.firstRun(resp); + runner.handleResponse(resp); } + + @Override + public void handleResponse(Object response) { + // TODO Auto-generated method stub + + } } MockDialog dialog = new MockDialog(); @@ -27,11 +33,13 @@ public class DialogRunnerTest public void testDialogRunner() { RunResponse ok, cancel, help, ineed; - final Response ooh = new Response("OOOOoooOOOOH!"), - r_ok = new Response("OK"), r_cancel = new Response("CANCEL"), - r_done = new Response("DONE"), r_help = new Response("HELP"), - r_ddoit = new Response("DIDNT DOIT"), - r_needsb = new Response("I NEED SOMEBODY"); + final String ooh = "OOOOoooOOOOH!"; + final String r_ok = "OK"; + final String r_cancel = "CANCEL"; + final String r_done = "DONE"; + final String r_help = "HELP"; + final String r_ddoit = "DIDNT DOIT"; + final String r_needsb = "I NEED SOMEBODY"; ok = new RunResponse("OK") { @@ -39,7 +47,7 @@ public class DialogRunnerTest @Override public void run() { - returned = new Response("DONE"); + returned = "DONE"; } }; final RunResponse befok = new RunResponse("OK") @@ -48,7 +56,7 @@ public class DialogRunnerTest @Override public void run() { - returned = new Response("OK"); + returned = "OK"; } }; @@ -80,7 +88,7 @@ public class DialogRunnerTest Assert.assertFalse(dialog.runner.isRegistered(ok)); - dialog.response(ok).response(cancel).response(help).response(ineed); + dialog.addResponse(ok).addResponse(cancel).addResponse(help).addResponse(ineed); Assert.assertTrue(dialog.runner.isRegistered(ok)); @@ -114,7 +122,7 @@ public class DialogRunnerTest // TODO: test prepend and chained execution of tasks for a response. Assert.assertFalse(dialog.runner.isRegistered(befok)); - dialog.runner.firstResponse(befok); + dialog.runner.setFirstResponse(befok); Assert.assertTrue(dialog.runner.isRegistered(befok)); Assert.assertTrue(dialog.runner.isRegistered(ok));