orpiske commented on code in PR #10291: URL: https://github.com/apache/camel/pull/10291#discussion_r1223232980
########## core/camel-yaml-io/src/test/java/org/apache/camel/yaml/out/XmlToYamlTest.java: ########## @@ -0,0 +1,78 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.camel.yaml.out; + +import java.io.FileInputStream; +import java.io.IOError; +import java.io.IOException; +import java.io.InputStream; +import java.io.StringWriter; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.stream.Stream; + +import org.apache.camel.model.RoutesDefinition; +import org.apache.camel.xml.in.ModelParser; +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.MethodSource; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class XmlToYamlTest { + + public static final String NAMESPACE = "http://camel.apache.org/schema/spring"; + + private static final Logger LOG = LoggerFactory.getLogger(XmlToYamlTest.class); + + @ParameterizedTest + @MethodSource("routes") + @DisplayName("Test xml to yaml for <routes>") + void testRoutes(String xml) throws Exception { + try (InputStream is = new FileInputStream("../camel-xml-io/src/test/resources/" + xml)) { + RoutesDefinition expected = new ModelParser(is, NAMESPACE).parseRoutesDefinition().get(); + StringWriter sw = new StringWriter(); + new ModelWriter(sw).writeRoutesDefinition(expected); + LOG.info("xml={}\n{}\n", xml, sw); + } + } Review Comment: I think there is a problem with this test: it is missing an assertion (so it would always pass). Maybe wrap the code with `Assertions.assertDoesNotThrow` to ensure it fails when there's a problem? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
