Comments (5)
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.
I am implementing this in this branch: feature/add_unit_tests
from java-sparkpost.
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.
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.
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)
- Log4j critical vulnerability!! HOT 4
- SuppressionList update endpoints throw com.google.gson.JsonSyntaxException
- RestConnection does not honor Client base URL
- Upgrade to Log4J 2.17.1
- Webhook events no longer derive from AbstractWebhookEvent, making getting type more difficult
- Webhook fields initial_pixel and open_tracking are presented as int, rather than boolean in event classes, making deserialization harder
- GSON error when calling insertOrUpdate or insertOrUpdateBulk
- Add 'template_id' key in X-MSYS-API Custom Header
- SparkPost/Java
- Unable to use Java SDK to map the Webhook Event
- Switch to using SLF4J HOT 2
- Webhook active property missing from model HOT 2
- Webhook properties are out of date HOT 1
- attach pdf HOT 2
- Webhook resource is missing /validate endpoint
- SparkPost Java API Suppression list limitations HOT 1
- event webhook - handle ping events
- Message Event API ending point changed - please update HOT 1
- TransimisionBase should allow other types than String for Metadata value HOT 2
- Subaccount CRUDs
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from java-sparkpost.