You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jena.apache.org by Claude Warren <cl...@xenei.com> on 2012/11/25 15:15:25 UTC

Contract Tests?

I am looking for a set of tests that I would call contract tests.

I am not looking for unit tests that show a model insert works but
rather things like the following:

// create a model
Model m = ModelFactory.createDefaultModel();
// create a resource
Resource r = m.createResource( "foo" );
// show resource is not in model
Assert.assertEquals( 0, r.listProperties().toList().size() );
// add resource to model
m.add( r, ResourceFactory.createProperty( "bar"), "Bar");
// add non model resource with same resource URL
m.add( ResourceFactory.createResource( "foo" ),
ResourceFactory.createProperty( "baz"), "Baz");
// verify that the existing resource was updated
Assert.assertEquals( 2, r.listProperties().toList().size() );

Basically a set of tests that prove an implementation meets all the
contracts of an API is what I am looking for.

-- 
I like: Like Like - The likeliest place on the web
Identity: https://www.identify.nu/user.php?claude@xenei.com
LinkedIn: http://www.linkedin.com/in/claudewarren

Re: Contract Tests?

Posted by Claude Warren <cl...@xenei.com>.
Actually, since I am implementing security as a dynamic proxy to graph
and model (dataset later) I need both.

Thanks for the pointer.. I will at it this evening.

--Claude

On Mon, Nov 26, 2012 at 10:36 AM, Damian Steer <d....@bristol.ac.uk> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On 25/11/12 14:15, Claude Warren wrote:
>> I am looking for a set of tests that I would call contract tests.
>
> <snip example model tests>
>
> I hope you're not trying to implement model. Will assume Graph.
>
>> Basically a set of tests that prove an implementation meets all
>> the contracts of an API is what I am looking for.
>
> IIRC I've used com.hp.hpl.jena.graph.test.AbstractTestGraph for this
> purpose. Subclass and provide a getGraph() method.
>
> Edit: on further inspection you may want MetaTestGraph:
>
>     MetaTestGraph.suite(MetaTestGraph.class, MyGraph.class)
>
> returns a suite of tests.
>
> Damian
>
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.11 (GNU/Linux)
> Comment: Using GnuPG with undefined - http://www.enigmail.net/
>
> iEYEARECAAYFAlCzRhsACgkQAyLCB+mTtykgJgCg0pyP+1gi0w6zd0pDv+LpqOov
> iwwAoKwFmIp/T4O8MyYQk1MTMs/JwvU3
> =Nuwu
> -----END PGP SIGNATURE-----



-- 
I like: Like Like - The likeliest place on the web
Identity: https://www.identify.nu/user.php?claude@xenei.com
LinkedIn: http://www.linkedin.com/in/claudewarren

Re: Contract Tests?

Posted by Damian Steer <d....@bristol.ac.uk>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 25/11/12 14:15, Claude Warren wrote:
> I am looking for a set of tests that I would call contract tests.

<snip example model tests>

I hope you're not trying to implement model. Will assume Graph.

> Basically a set of tests that prove an implementation meets all
> the contracts of an API is what I am looking for.

IIRC I've used com.hp.hpl.jena.graph.test.AbstractTestGraph for this
purpose. Subclass and provide a getGraph() method.

Edit: on further inspection you may want MetaTestGraph:

    MetaTestGraph.suite(MetaTestGraph.class, MyGraph.class)

returns a suite of tests.

Damian


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with undefined - http://www.enigmail.net/

iEYEARECAAYFAlCzRhsACgkQAyLCB+mTtykgJgCg0pyP+1gi0w6zd0pDv+LpqOov
iwwAoKwFmIp/T4O8MyYQk1MTMs/JwvU3
=Nuwu
-----END PGP SIGNATURE-----