Giter Club home page Giter Club logo

Comments (5)

yepher avatar yepher commented on August 17, 2024

I propose that the API unit tests verify for proper JSON output . We could do something like this:

Use this library: https://github.com/lukas-krecan/JsonUnit

Pom:

<dependency>
    <groupId>net.javacrumbs.json-unit</groupId>
    <artifactId>json-unit</artifactId>
    <version>1.5.0</version>
    <scope>test</scope>
</dependency>

IGNORING_ARRAY_ORDER - ignores order in arrays

assertJsonEquals("{\"test\":[1,2,3]}", "{\"test\":[3,2,1]}",when(IGNORING_ARRAY_ORDER));

For RestCon unit testing we should probably just mock out the http client part and make sure it does what we expect it to do.

Once I get some feedback on issue #6 I can probably do this easily. I am getting a little scared to keep going on feature/issue6_libify_sdk because there are a lot of changes stacking up there. Once the project structure is agreed upon I will pull current Integration-Unit tests into the app code and create unit tests focusing initially on the lib.

from java-sparkpost.

yepher avatar yepher commented on August 17, 2024

I am implementing this in this branch: feature/add_unit_tests

here

from java-sparkpost.

bizob2828 avatar bizob2828 commented on August 17, 2024

I would just mock the APIs you are calling. Maybe that's your plan but wasn't very clear with your comments

from java-sparkpost.

yepher avatar yepher commented on August 17, 2024

Yes, I unit test the JSON where I copy string straight from here to make sure it parses and I also round trip the JSON to make sure it works that way too. You can see the JSON tests here

Next I will move on to Mocking out the HTTP calls. Although I would really like to discuss some design alternative to the current ResourceXXX implementation with someone who would like to discuss it.

from java-sparkpost.

yepher avatar yepher commented on August 17, 2024

This is fixed in this pull request: #14

There is also a sample to delete test templates and list all templates

from java-sparkpost.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.