incubator-isis-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adam Howard <>
Subject Re: Running a specific unit test
Date Tue, 19 Jun 2012 05:58:06 GMT

I'll leave the Ignored tests alone. I started writing my own, working
backwards from DomainObjectReprRenderer.render() but I've gotten
a little lost. Can you direct me to any helper classes I could use? I
am defining a class with an iconName method and I want to ensure
the JsonRepresentation has a rel="icon" link.

    private class MyDomainObject {
        public String iconName() {
            return "myIcon";
        public String getFirstName() { return null; }
        public void setFirstName() {}

    public void test() {
        context.checking(new Expectations() {
        FacetedMethod facetedMethod =
FacetedMethod.createProperty(MyDomainObject.class, "firstName");

        IconMethodFacetFactory facetFactory = new IconMethodFacetFactory();
ProcessClassContext(MyDomainObject.class, new
ProgrammableMethodRemover(), facetedMethod));

        final Facet facet = facetedMethod.getFacet(IconFacet.class);
        final RendererFactory factory = new DomainObjectReprRenderer.Factory();
        final ResourceContext resourceContext = new
ResourceContext(null, null, null, null, httpServletRequest, null,
null, null, null, null, null, null, null);
        final DomainObjectReprRenderer renderer =
(DomainObjectReprRenderer) factory.newRenderer(resourceContext, null,
        final SpecificationContext specificationContext = new
SpecificationContext(null, null, null, null);
        final FacetedMethodsBuilderContext
facetedMethodsBuilderContext = new FacetedMethodsBuilderContext(null,
null, null, null);
        final ObjectSpecification objectSpecification = new
facetedMethodsBuilderContext, null, specificationContext, null, null);
        final SpecificationLoader specificationLoader =
        context.checking(new Expectations() {
        final ObjectAdapter objectAdapter = new PojoAdapter(new
MyDomainObject(), null, specificationLoader, null, null);
        final JsonRepresentation jsonRepresentation =

Any tips are appreciated.
Adam Howard

> Hi Adam,
> yes, sorry about all those @Ignore'd tests.  It's not very professional of
> me to have left them in there.
> The story is that I was attempting to develop the Isis viewer in
> conjunction with the RO spec, while at the same time supporting Richard
> (Pawson) and Stef (Cascarini) who were developing the .NET equivalent [1].
>  Long story short, they caught up and overtook my own implementation in
> Isis.  Those @Ignore was a result of me getting lazy and dropping the tests
> that I had broken while attempting to maintain velocity.
> On the other hand, one of the things that Richard and Stef have also done
> is written ~300 end-to-end tests against their implementation, for version
> 1.0.  My intention is to take them and port them from C# to Java, such that
> they become a "TCK" for the spec.
> As regards the Isis tests, best to carry on ignoring them.  I will go
> through at some point and salvage them as best I can.  Create your own new
> tests though for the patch you are working on.
> Thx
> Dan
> [1]
> On 18 June 2012 03:10, Adam Howard <> wrote:
>> All,
>> I checked out the full isis package at
>> to start working
>> on the icon link for the json viewer. I saw that there was already a
>> testcase for this in DomainObjectResourceTest in the json-tck project,
>> domainObjectWithIcon. It was marked @Ignore so I commented that out
>> and had eclipse run the class as a junit test. All of the tests failed
>> because the status assertion in givenDomainObjectRepresentationFor was
>> never successful. When I first built the whole system everything
>> passed. Is there some way to just run one test class?
>> Thanks.
>> --
>> Adam Howard

View raw message