5 Replies Latest reply on Feb 6, 2017 10:47 AM by ttielebein RSS
    roberttay Apprentice

    JUnit tests with thingworx-ext-sdk

    Greetings,

    I'm trying to write some unit tests for my Java extensions and need to mock some classes.

     

    I ran into this when trying to mock a Thing with certain properties.

     

    Thing t = new Thing();

    ThingProperty tp = t.addProperty(new PropertyDefinition("propertyName", "propertyDescription", BaseTypes.Boolean);

     

    tp == null?

     

    How could this be? Then i decompiled the thingworx-ext-sdk to find that most of the methods in the thingworx-ext-sdk are either simply empty (not implemented) or return null or some primitive value.

     

    So, I thought that it would be useful to only use the thingworx-ext-sdk for compilation and the thingworx-sdk for testing, but i couldn't figure out how to make this work.

    BTW, I'm using Eclipse as my IDE.

     

    How do others unit tests their java extensions?