ee.jakarta.tck.jsonp.api.mergetests.MergeTests Maven / Gradle / Ivy
The newest version!
/*
* Copyright (c) 2020, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0, which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* This Source Code may also be made available under the following Secondary
* Licenses when the conditions for such availability set forth in the
* Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
* version 2 with the GNU Classpath Exception, which is available at
* https://www.gnu.org/software/classpath/license.html.
*
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
*/
package ee.jakarta.tck.jsonp.api.mergetests;
import ee.jakarta.tck.jsonp.api.common.TestResult;
import org.junit.jupiter.api.Test;
import org.opentest4j.AssertionFailedError;
// $Id$
/**
* RFC 7396: JavaScript Object Notation (JSON) Merge Patch compatibility
* tests.
* {@see RFC 7396}.
*/
public class MergeTests {
/**
* Test JSON-P API response on
* {@see RFC 7396: 1.
* Introduction}: If the provided merge patch contains members that do not
* appear within the target, those members are added.
*
* @throws AssertionFailedError
* when this test failed.
*
* @testName: jsonMergeAddValueTest
* @assertion_ids: JSONP:JAVADOC:575; JSONP:JAVADOC:576; JSONP:JAVADOC:616;
* JSONP:JAVADOC:617; JSONP:JAVADOC:620; JSONP:JAVADOC:654;
* JSONP:JAVADOC:655;
* @test_Strategy: Test API response on various JSON values.
*/
@Test
public void jsonMergeAddValueTest() {
MergeAddValue addTest = new MergeAddValue();
final TestResult result = addTest.test();
result.eval();
}
/**
* Test JSON-P API response on
* {@see RFC 7396: 1.
* Introduction}: If the target does contain the member, the value is
* replaced.
*
* @throws AssertionFailedError
* when this test failed.
*
* @testName: jsonMergeReplaceValueTest
* @assertion_ids: JSONP:JAVADOC:575; JSONP:JAVADOC:576; JSONP:JAVADOC:616;
* JSONP:JAVADOC:617; JSONP:JAVADOC:654; JSONP:JAVADOC:655;
* @test_Strategy: Test API response on various JSON values.
*/
@Test
public void jsonMergeReplaceValueTest() {
MergeReplaceValue replaceTest = new MergeReplaceValue();
final TestResult result = replaceTest.test();
result.eval();
}
/**
* Test JSON-P API response on
* {@see RFC 7396: 1.
* Introduction}: {@code null} values in the merge patch are given special
* meaning to indicate the removal of existing values in the target.
*
* @throws AssertionFailedError
* when this test failed.
*
* @testName: jsonMergeRemoveValueTest
* @assertion_ids: JSONP:JAVADOC:575; JSONP:JAVADOC:576; JSONP:JAVADOC:616;
* JSONP:JAVADOC:617; JSONP:JAVADOC:654; JSONP:JAVADOC:655;
* @test_Strategy: Test API response on various JSON values.
*/
@Test
public void jsonMergeRemoveValueTest() {
MergeRemoveValue removeTest = new MergeRemoveValue();
final TestResult result = removeTest.test();
result.eval();
}
/**
* Test JSON-P API response on
* {@see RFC 7396: 1.
* Introduction}: If the patch is anything other than an object, the
* result will always be to replace the entire target with the entire patch.
*
* @throws AssertionFailedError
* when this test failed.
*
* @testName: jsonMergeNonObjectTest
* @assertion_ids: JSONP:JAVADOC:575; JSONP:JAVADOC:576; JSONP:JAVADOC:616;
* JSONP:JAVADOC:617; JSONP:JAVADOC:654; JSONP:JAVADOC:655;
* JSONP:JAVADOC:583; JSONP:JAVADOC:584;
* @test_Strategy: Test API response on various JSON values.
*/
@Test
public void jsonMergeNonObjectTest() {
MergeNonObject nonObjTest = new MergeNonObject();
final TestResult result = nonObjTest.test();
result.eval();
}
/**
* Test JSON-P API response on Test based on
* {@see RFC 7396: 3.
* Example} objects.
*
* @throws AssertionFailedError
* when this test failed.
*
* @testName: jsonMergeRFCSampleTest
* @assertion_ids: JSONP:JAVADOC:575; JSONP:JAVADOC:576; JSONP:JAVADOC:616;
* JSONP:JAVADOC:617; JSONP:JAVADOC:654; JSONP:JAVADOC:655;
* @test_Strategy: Test API response on RFC example objects.
*/
@Test
public void jsonMergeRFCSampleTest() {
MergeRFCSample rfcSampleTest = new MergeRFCSample();
final TestResult result = rfcSampleTest.test();
result.eval();
}
}