Skip to content

Tests #116

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed

Tests #116

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ buildscript {
repositories {
mavenCentral()
maven {
url "http://repo.springsource.org/plugins-release";
url "https://repo.springsource.org/plugins-release";
}
}
dependencies {
Expand Down
14 changes: 14 additions & 0 deletions src/test/java/com/github/fge/jsonpatch/query/AddOperationTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.github.fge.jsonpatch.query;

import com.github.fge.jsonpatch.JsonPatchOperationTest;
import org.testng.annotations.Ignore;

import java.io.IOException;

@Ignore
public class AddOperationTest extends JsonPatchOperationTest {

public AddOperationTest() throws IOException {
super("query/add");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.github.fge.jsonpatch.query;

import com.github.fge.jsonpatch.JsonPatchOperationTest;
import org.testng.annotations.Ignore;

import java.io.IOException;

@Ignore
public class RemoveOperationTest extends JsonPatchOperationTest {

public RemoveOperationTest() throws IOException {
super("query/remove");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.github.fge.jsonpatch.query;

import com.github.fge.jsonpatch.JsonPatchOperationTest;
import org.testng.annotations.Ignore;

import java.io.IOException;

@Ignore
public class ReplaceOperationTest extends JsonPatchOperationTest {

public ReplaceOperationTest() throws IOException {
super("query/replace");
}
}
38 changes: 38 additions & 0 deletions src/test/resources/jsonpatch/query/add.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"errors": [],
"ops": [
{
"description": "TMF630 - Example 1 - Adding an attribute to one of the components of an array",
"op": {
"op": "add",
"path": "/note/text?note.author=John Doe",
"value":"Informed"
},
"node": {
"id": "1",
"correlationId": "TT53482",
"note": [{
"date": "2013-07-24T09:55:30.0Z",
"author": "Arthur Evans"
},
{
"date": "2013-07-25T08:55:12.0Z",
"author": "John Doe"
}]
},
"expected": {
"id": "1",
"correlationId": "TT53482",
"note": [{
"date": "2013-07-24T09:55:30.0Z",
"author": "Arthur Evans"
},
{
"date": "2013-07-25T08:55:12.0Z",
"author": "John Doe",
"text": "Informed"
}]
}
}
]
}
130 changes: 130 additions & 0 deletions src/test/resources/jsonpatch/query/remove.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
{
"ops": [
{
"description": "TMF630 - Example 2 - Removing one of the components of an Array Element (the whole structure)",
"op": {
"op": "remove",
"path": "/note?note.author=John Doe"
},
"node": {
"id": "1",
"correlationId": "TT53482",
"note": [
{
"date": "2013-07-24T09:55:30.0Z",
"author": "Arthur Evans",
"text": "Already called the expert"
},
{
"date": "2013-07-25T08:55:12.0Z",
"author": "John Doe",
"text": "Informed "
},
{
"date": "2013-07-25T07:55:12.0Z",
"author": "Diego Salas",
"text": "Resolved issue"
}
]
},
"expected": {
"id": "1",
"correlationId": "TT53482",
"note": [
{
"date": "2013-07-24T09:55:30.0Z",
"author": "Arthur Evans",
"text": "Already called the expert"
},
{
"date": "2013-07-25T07:55:12.0Z",
"author": "Diego Salas",
"text": "Resolved issue"
}
]
}
},
{
"description": "TMF630 - Example 3 - Removing an attribute from one of the components of an array",
"op": {
"op": "remove",
"path": "/productPrice/prodPriceAlteration?prodPrice.name=Regular Price"
},
"node": {
"id": "4501",
"description": "This product .... ",
"productPrice": [
{
"name": "Regular Price",
"priceType": "recurring",
"prodPriceAlteration": {
"name": "Shipping Discount ",
"description": "This prod price alteration ... "
},
"price": 4.99
},
{
"name": "Setup Price",
"priceType": "one time",
"price": 6.20
}
]
},
"expected": {
"id": "4501",
"description": "This product .... ",
"productPrice": [
{
"name": "Regular Price",
"priceType": "recurring",
"price": 4.99
},
{
"name": "Setup Price",
"priceType": "one time",
"price": 6.20
}
]
}
},
{
"description": "TMF630 - Example 4 - Removing a complete complex structure component of an array",
"op": { "op": "remove", "path": "/productPrice? productPrice.name=Setup Price" },
"node": {
"id": "4501",
"description": "This product .... ",
"productPrice": [
{
"name": "Setup Price",
"priceType": "one time",
"price": 4.99
},
{
"name": "Regular Price",
"priceType": "recurring",
"prodPriceAlteration": {
"name": "Shipping Discount ",
"description": "This prod price alteration ... "
},
"price": 6.20
}
]
},
"expected": {
"id": "4501",
"description": "This product .... ",
"productPrice": [
{
"name": "Regular Price",
"priceType": "recurring",
"prodPriceAlteration": {
"name": "Shipping Discount ",
"description": "This prod price alteration ... "
},
"price": 6.20
}
]
}
}
]
}
Loading