This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 11.0.x in repository https://gitbox.apache.org/repos/asf/tomcat.git
commit 89e573e582264afe77db45609b3e839b31de8a8a Author: Mark Thomas <ma...@apache.org> AuthorDate: Thu Sep 26 16:32:03 2024 +0100 Add tests for empty --- test/org/apache/el/parser/TestAstEmpty.java | 40 ++++++++++++++++++++++++++ test/org/apache/el/parser/TestAstNotEmpty.java | 40 ++++++++++++++++++++++++++ 2 files changed, 80 insertions(+) diff --git a/test/org/apache/el/parser/TestAstEmpty.java b/test/org/apache/el/parser/TestAstEmpty.java new file mode 100644 index 0000000000..1523967189 --- /dev/null +++ b/test/org/apache/el/parser/TestAstEmpty.java @@ -0,0 +1,40 @@ +/* + * 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.el.parser; + +import jakarta.el.ELProcessor; + +import org.junit.Assert; +import org.junit.Test; + +public class TestAstEmpty { + + @Test + public void test01() { + ELProcessor processor = new ELProcessor(); + Boolean result = processor.eval("empty 'abc'"); + Assert.assertEquals(Boolean.FALSE, result); + } + + + @Test + public void test02() { + ELProcessor processor = new ELProcessor(); + Boolean result = processor.eval("empty ''"); + Assert.assertEquals(Boolean.TRUE, result); + } +} diff --git a/test/org/apache/el/parser/TestAstNotEmpty.java b/test/org/apache/el/parser/TestAstNotEmpty.java new file mode 100644 index 0000000000..dceca6bb1c --- /dev/null +++ b/test/org/apache/el/parser/TestAstNotEmpty.java @@ -0,0 +1,40 @@ +/* + * 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.el.parser; + +import jakarta.el.ELProcessor; + +import org.junit.Assert; +import org.junit.Test; + +public class TestAstNotEmpty { + + @Test + public void test01() { + ELProcessor processor = new ELProcessor(); + Boolean result = processor.eval("not empty 'abc'"); + Assert.assertEquals(Boolean.TRUE, result); + } + + + @Test + public void test02() { + ELProcessor processor = new ELProcessor(); + Boolean result = processor.eval("not empty ''"); + Assert.assertEquals(Boolean.FALSE, result); + } +} --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org