abdera-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chris Berry" <chriswbe...@gmail.com>
Subject unit testing RegexTargetResolver
Date Tue, 09 Oct 2007 14:03:10 GMT
Greetings,
I would like to write a compact JUnit test around the RegexTargetResolver.
This way I can verify that particular URLs resolves to the correct type;
SERVICE,COLLECTION,ENTRY
without having to bring in the rest of the Abdera machinery (i.e. having to
make an actual call)

I can get a hold of the RegexTargetResolver pretty easily.
But it requires a Request object;

         public Target resolve(Request request)

And I don't see an easy way to create a Request to use in this scenario.
E.g. something like this;

        AbderaClient client = new AbderaClient();
        RequestOptions options = client.getDefaultRequestOptions();

    // the following doesn't exist...
        options.setURL( "http://localhost:8080/foo/bar" );

    TargetType type = targetResolver.resolve( options ).getType();
    assertTrue( type.equals( TargetType.SERVICE );

Is there a simple way to accomplish this??
Thanks much,
-- Chris

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message