elharo commented on code in PR #449: URL: https://github.com/apache/commons-text/pull/449#discussion_r1299407880
########## src/test/java/org/apache/commons/text/lookup/XmlDecoderStringLookupTest.java: ########## @@ -0,0 +1,46 @@ +/* + * 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.commons.text.lookup; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +/** + * Tests {@link XmlDecoderStringLookup}. + */ +public class XmlDecoderStringLookupTest { + + private static final String DATA = "<element>"; Review Comment: inline. DATA is much less clear than the literal string. Named constants are for numbers, not strings. ########## src/test/java/org/apache/commons/text/lookup/XmlEncoderStringLookupTest.java: ########## @@ -0,0 +1,46 @@ +/* + * 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.commons.text.lookup; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +/** + * Tests {@link XmlEncoderStringLookup}. + */ +public class XmlEncoderStringLookupTest { + + private static final String DATA = "<element>"; Review Comment: inline. DATA is much less clear than the literal string. Named constants are for numbers, not strings. ########## src/main/java/org/apache/commons/text/lookup/XmlEncoderStringLookup.java: ########## @@ -0,0 +1,44 @@ +/* + * 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.commons.text.lookup; + +import org.apache.commons.text.StringEscapeUtils; + +/** + * Encodes strings according to the XML 1.0 specification. + * + * @see StringEscapeUtils#escapeXml10(String) + * @since 1.11.0 + */ +final class XmlEncoderStringLookup extends AbstractStringLookup { + + /** + * Defines the singleton for this class. + */ + static final XmlEncoderStringLookup INSTANCE = new XmlEncoderStringLookup(); + + XmlEncoderStringLookup() { Review Comment: private ########## src/main/java/org/apache/commons/text/lookup/XmlDecoderStringLookup.java: ########## @@ -0,0 +1,44 @@ +/* + * 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.commons.text.lookup; + +import org.apache.commons.text.StringEscapeUtils; + +/** + * Decodes strings according to the XML 1.0 specification. + * + * @see StringEscapeUtils#unescapeXml(String) + * @since 1.11.0 + */ +final class XmlDecoderStringLookup extends AbstractStringLookup { + + /** + * Defines the singleton for this class. + */ + static final XmlDecoderStringLookup INSTANCE = new XmlDecoderStringLookup(); + + XmlDecoderStringLookup() { Review Comment: private -- 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]
