ttomcat-1778514358873.zip-extract/apache-tomcat-11.0.18-src/test/jakarta/el/TestELResolver.java

Path
ttomcat-1778514358873.zip-extract/apache-tomcat-11.0.18-src/test/jakarta/el/TestELResolver.java
Status
scanned
Type
file
Name
TestELResolver.java
Extension
.java
Programming language
Java
Mime type
text/plain
File type
ASCII text, with CRLF line terminators
Tag

      
    
Rootfs path

      
    
Size
4390 (4.3 KB)
MD5
841a014b1dbeb39197393a081b69831b
SHA1
98f6bc037ec2c8ff663f30ef2bfa2bcb64c0ba39
SHA256
99665bf0f717690293613d4020c8065ee66bc10a93382001e576112437c68a42
SHA512

      
    
SHA1_git
edc0fe14bbe67f2ed2bbe0105564145064dc5cf6
Is binary

      
    
Is text
True
Is archive

      
    
Is media

      
    
Is legal

      
    
Is manifest

      
    
Is readme

      
    
Is top level

      
    
Is key file

      
    
TestELResolver.java | 4.3 KB |

/* * 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 jakarta.el; import org.junit.Assert; import org.junit.Test; public class TestELResolver { @Test public void testConvertToType01() { ELContext context = new TesterELContext(); ValueExpression ve = ELManager.getExpressionFactory().createValueExpression(context, "1", String.class); String result = (String) ve.getValue(context); Assert.assertEquals("1", result); } @Test public void testConvertToType02() { ELContext context = new TesterELContext(new TesterELResolverOne()); ValueExpression ve = ELManager.getExpressionFactory().createValueExpression(context, "1", String.class); String result = (String) ve.getValue(context); Assert.assertEquals("ONE", result); } @Test public void testConvertToType03() { ELContext context = new TesterELContext(new TesterELResolverOne()); ValueExpression ve = ELManager.getExpressionFactory().createValueExpression(context, "2", String.class); String result = (String) ve.getValue(context); Assert.assertEquals("2", result); } @Test public void testConvertToType04() { CompositeELResolver resolver = new CompositeELResolver(); ELContext context = new TesterELContext(resolver); ValueExpression ve = ELManager.getExpressionFactory().createValueExpression(context, "2", String.class); String result = (String) ve.getValue(context); Assert.assertEquals("2", result); } @Test public void testConvertToType05() { CompositeELResolver resolver = new CompositeELResolver(); resolver.add(new TesterELResolverOne()); resolver.add(new TesterELResolverTwo()); ELContext context = new TesterELContext(resolver); ValueExpression ve = ELManager.getExpressionFactory().createValueExpression(context, "1", String.class); String result = (String) ve.getValue(context); Assert.assertEquals("ONE", result); } @Test public void testConvertToType06() { CompositeELResolver resolver = new CompositeELResolver(); resolver.add(new TesterELResolverOne()); resolver.add(new TesterELResolverTwo()); ELContext context = new TesterELContext(resolver); ValueExpression ve = ELManager.getExpressionFactory().createValueExpression(context, "2", String.class); String result = (String) ve.getValue(context); Assert.assertEquals("TWO", result); } @Test public void testConvertToType07() { CompositeELResolver resolver = new CompositeELResolver(); resolver.add(new TesterELResolverOne()); resolver.add(new TesterELResolverTwo()); ELContext context = new TesterELContext(resolver); ValueExpression ve = ELManager.getExpressionFactory().createValueExpression(context, "3", String.class); String result = (String) ve.getValue(context); Assert.assertEquals("3", result); } // https://bz.apache.org/bugzilla/show_bug.cgi?id=57802 @Test public void testDefaultConvertToType() { ELContext context = new TesterELContext(new StaticFieldELResolver()); ValueExpression ve = ELManager.getExpressionFactory().createValueExpression(context, "${!Boolean.FALSE}", Boolean.class); Boolean result = (Boolean) ve.getValue(context); Assert.assertEquals(Boolean.TRUE, result); } }
Detected license expression
apache-2.0
Detected license expression (SPDX)
Apache-2.0
Percentage of license text
29.6
Copyrights

      
    
Holders

      
    
Authors

      
    
License detections License expression License expression SPDX
apache_2_0-4bde3f57-78aa-4201-96bf-531cba09e7de apache-2.0 Apache-2.0
URL Start line End line
http://www.apache.org/licenses/LICENSE-2.0 9 9
https://bz.apache.org/bugzilla/show_bug.cgi?id=57802 117 117