Mason Ham wrote:
> It can be summarized in the following code that I added. I though you
> might want to add it in :-) /**
> * This will allow you to call a specific function from the command
> line.
> * It uses reflection to make the call. It is useful for "learning"
> how to write
> * ECS pages etc. It is simple reflection and so it assumes that any
> * method you are calling has no parameters.
> *
> * TODO: make it so that you can call with parameters etc
> *
> * @param method This is the method that you want to make the call
> on.
> * @param ecs This is the ecs testbed instance to call on.
> */
> private static void callMethod(String method, TestBed ecs){
> try{
> java.lang.reflect.Method meth = TestBed.class.getMethod(method, new
> Class[]{});
> meth.invoke(ecs , new Class[]{});
> } catch (Exception e){
> e.printStackTrace();
> }
> } You can then add this code to the main to make it happen.TestBed
> ecs = new TestBed(); if (args.length == 1) {
> callMethod(args[0], ecs);
> }
i think that this is change is useful.
it means that you can run a single test method by typing (for example)
> java TestBed testLink
without having to comment and uncomment the TestBed source.
another advantage of this way of doing things is that you can easily add
new test methods without worrying too much about maintaining the main
method.
i have a version of TestBed using some of this code which i can commit
if there's agreement that this is a good idea.
(before you ask, the version i have can also run all test methods by
giving 'all' as a parameter.)
(BTW i'm +1 if that's not clear).
- robert
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]