@@ -0,0 +1,2749 @@
+package cat.calidos.morfeu.control;%0A%0Aimport static org.junit.jupiter.api.Assertions.*;%0A%0Aimport java.util.List;%0Aimport java.util.Optional;%0Aimport java.util.concurrent.ExecutionException;%0A%0Aimport org.junit.jupiter.api.DisplayName;%0Aimport org.junit.jupiter.api.Test;%0A%0Aimport cat.calidos.morfeu.model.Cell;%0Aimport cat.calidos.morfeu.model.injection.ModelTezt;%0Aimport cat.calidos.morfeu.problems.ParsingException;%0Aimport cat.calidos.morfeu.problems.ValidationException;%0A%0A/**%0A*%09@author daniel giribet%0A*///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////%0Apublic class ContentGETControlTest extends ModelTezt %7B%0A%0A%0A@Test @DisplayName(%22Content GET test%22)%0Apublic void contentGET() throws Exception %7B%0A%0A%09String prefix = testAwareFullPathFrom(%22.%22);%0A%09String path = %22test-resources/documents/document1.xml%22;%0A%09String model = %22test-resources/models/test-model.xsd%22;%0A%09@SuppressWarnings(%22unchecked%22)%0A%09List%3CCell%3E content = (List%3CCell%3E) new ContentGETControl(prefix, path, Optional.empty(), model).process();%0A%09assertNotNull(content);%0A%0A%09Cell test = content.get(0);%0A%09assertAll(%22test basic content%22,%0A%09%09() -%3E assertNotNull(test),%0A%09%09() -%3E assertEquals(%22test-resources/documents/document1.xml%22, test.getURI().toString()),%0A%09%09() -%3E assertTrue(test.isComplex())%0A%09);%0A%0A%7D%0A%0A%0A@Test @DisplayName(%22Content GET filtered test%22)%0Apublic void contentGETFiltered() throws Exception %7B%0A%0A%0A%09String prefix = testAwareFullPathFrom(%22.%22);%0A%09String path = %22test-resources/documents/filtered.xml%22;%0A%09String model = %22test-resources/models/test-model.xsd%22;%0A%09String f = %22replace%7B%5C%22replacements%5C%22:%5B%22 +%0A%09%09%09%22%7B%5C%22from%5C%22:%5C%22=%5C%5C%5C%5Cs*%5C%5C%5C%5C%7B%5C%22,%5C%22to%5C%22:%5C%22=%5C%5C%5C%22%7B%5C%22%7D,%22+%0A%09%09%09%22%7B%5C%22from%5C%22:%5C%22%7D%5C%22,%5C%22to%5C%22:%5C%22%7D%5C%5C%5C%22%5C%22%7D%22 +%0A%09%09%22%5D%7D%22;%0A%09Optional%3CString%3E filters = Optional.of(f);%09// if the filters are not applied we get a different exception%0A%09assertThrows(ValidationException.class, () -%3E new ContentGETControl(prefix, path, filters, model).process());%0A%09System.err.println(%22Ignore the next exception, thrown during testing%22);%0A%09assertThrows(ExecutionException.class, () -%3E new ContentGETControl(prefix, path, Optional.empty(), model).process());%0A%0A%7D%0A%0A%0A%7D%0A%0A/*%0A *    Copyright 2020 Daniel Giribet%0A *%0A *   Licensed under the Apache License, Version 2.0 (the %22License%22);%0A *   you may not use this file except in compliance with the License.%0A *   You may obtain a copy of the License at%0A *%0A *       http://www.apache.org/licenses/LICENSE-2.0%0A *%0A *   Unless required by applicable law or agreed to in writing, software%0A *   distributed under the License is distributed on an %22AS IS%22 BASIS,%0A *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A *   See the License for the specific language governing permissions and%0A *   limitations under the License.%0A */%0A%0A

test get control