DATAREST-995 - Removed support for ~ to reference a last collection element in JSON Patch.
Completely removed the support for ~ in favor of the previously introduced support for the correct indicator -.
This commit is contained in:
@@ -31,7 +31,7 @@ import org.springframework.expression.spel.standard.SpelExpressionParser;
|
||||
public class PathToSpEL {
|
||||
|
||||
private static final SpelExpressionParser SPEL_EXPRESSION_PARSER = new SpelExpressionParser();
|
||||
static final List<String> APPEND_CHARACTERS = Arrays.asList("-", "~");
|
||||
static final List<String> APPEND_CHARACTERS = Arrays.asList("-");
|
||||
|
||||
/**
|
||||
* Converts a patch path to an {@link Expression}.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2016 the original author or authors.
|
||||
* Copyright 2014-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -121,14 +121,14 @@ public class CopyOperationTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void copyListElementToEndOfList_usingTilde() throws Exception {
|
||||
public void copyListElementToEndOfList_usingDash() throws Exception {
|
||||
|
||||
List<Todo> todos = new ArrayList<Todo>();
|
||||
todos.add(new Todo(1L, "A", true));
|
||||
todos.add(new Todo(2L, "B", false));
|
||||
todos.add(new Todo(3L, "C", false));
|
||||
|
||||
CopyOperation copy = new CopyOperation("/~", "/0");
|
||||
CopyOperation copy = new CopyOperation("/-", "/0");
|
||||
copy.perform(todos, Todo.class);
|
||||
|
||||
assertEquals(4, todos.size());
|
||||
@@ -137,14 +137,14 @@ public class CopyOperationTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void copyListElementFromEndOfList_usingTilde() throws Exception {
|
||||
public void copyListElementFromEndOfList_usingDash() throws Exception {
|
||||
|
||||
List<Todo> todos = new ArrayList<Todo>();
|
||||
todos.add(new Todo(1L, "A", true));
|
||||
todos.add(new Todo(2L, "B", false));
|
||||
todos.add(new Todo(3L, "C", false));
|
||||
|
||||
CopyOperation copy = new CopyOperation("/0", "/~");
|
||||
CopyOperation copy = new CopyOperation("/0", "/-");
|
||||
copy.perform(todos, Todo.class);
|
||||
|
||||
assertEquals(4, todos.size());
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2016 the original author or authors.
|
||||
* Copyright 2014-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -135,7 +135,7 @@ public class MoveOperationTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void moveListElementToBeginningOfList_usingTilde() throws Exception {
|
||||
public void moveListElementToBeginningOfList_usingDash() throws Exception {
|
||||
|
||||
List<Todo> todos = new ArrayList<Todo>();
|
||||
todos.add(new Todo(1L, "A", true));
|
||||
@@ -149,13 +149,13 @@ public class MoveOperationTests {
|
||||
expected.add(new Todo(3L, "C", false));
|
||||
expected.add(new Todo(4L, "E", false));
|
||||
|
||||
MoveOperation move = new MoveOperation("/1", "/~");
|
||||
MoveOperation move = new MoveOperation("/1", "/-");
|
||||
move.perform(todos, Todo.class);
|
||||
assertEquals(expected, todos);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void moveListElementToEndOfList_usingTilde() throws Exception {
|
||||
public void moveListElementToEndOfList_usingDash() throws Exception {
|
||||
|
||||
List<Todo> todos = new ArrayList<Todo>();
|
||||
todos.add(new Todo(1L, "A", true));
|
||||
@@ -169,7 +169,7 @@ public class MoveOperationTests {
|
||||
expected.add(new Todo(4L, "E", false));
|
||||
expected.add(new Todo(2L, "G", false));
|
||||
|
||||
MoveOperation move = new MoveOperation("/~", "/1");
|
||||
MoveOperation move = new MoveOperation("/-", "/1");
|
||||
move.perform(todos, Todo.class);
|
||||
assertEquals(expected, todos);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2016 the original author or authors.
|
||||
* Copyright 2014-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -39,9 +39,9 @@ public class PathToSpelTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void listTilde() {
|
||||
public void accessesLastCollectionElementWithDash() {
|
||||
|
||||
Expression expr = PathToSpEL.pathToExpression("/~/description");
|
||||
Expression expr = PathToSpEL.pathToExpression("/-/description");
|
||||
|
||||
List<Todo> todos = new ArrayList<Todo>();
|
||||
todos.add(new Todo(1L, "A", false));
|
||||
|
||||
Reference in New Issue
Block a user