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

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

      
    
Rootfs path

      
    
Size
2985 (2.9 KB)
MD5
17a995900d0e891b1f40cea1e0bb4a69
SHA1
dbdbafc2e9ed14beccc4f719e5cc67c62ac87fe8
SHA256
78d9e155d261cab512e46217bc17aafdd32f7366550f9d948e6e785b1b18e001
SHA512

      
    
SHA1_git
0b7c691e19774e92b9a886457c3caadf254d1445
Is binary

      
    
Is text
True
Is archive

      
    
Is media

      
    
Is legal

      
    
Is manifest

      
    
Is readme

      
    
Is top level

      
    
Is key file

      
    
TestRecordELResolver.java | 2.9 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 TestRecordELResolver { private static final String TEXT_DATA = "text"; private static final long LONG_DATA = 1234; @Test public void testRecordTextField() { ExpressionFactory factory = ExpressionFactory.newInstance(); StandardELContext context = new StandardELContext(factory); TesterRecordA recordA = new TesterRecordA(TEXT_DATA, LONG_DATA); ValueExpression varRecordA = factory.createValueExpression(recordA, TesterRecordA.class); context.getVariableMapper().setVariable("recordA", varRecordA); ValueExpression ve = factory.createValueExpression(context, "${recordA.text}", String.class); String result = ve.getValue(context); Assert.assertEquals(TEXT_DATA, result); } @Test(expected = ELException.class) public void testRecordUnknownField() { ExpressionFactory factory = ExpressionFactory.newInstance(); StandardELContext context = new StandardELContext(factory); TesterRecordA recordA = new TesterRecordA(TEXT_DATA, LONG_DATA); ValueExpression varRecordA = factory.createValueExpression(recordA, TesterRecordA.class); context.getVariableMapper().setVariable("recordA", varRecordA); ValueExpression ve = factory.createValueExpression(context, "${recordA.unknown}", String.class); ve.getValue(context); } @Test public void testRecordNumericField() { ExpressionFactory factory = ExpressionFactory.newInstance(); StandardELContext context = new StandardELContext(factory); TesterRecordA recordA = new TesterRecordA(TEXT_DATA, LONG_DATA); ValueExpression varRecordA = factory.createValueExpression(recordA, TesterRecordA.class); context.getVariableMapper().setVariable("recordA", varRecordA); ValueExpression ve = factory.createValueExpression(context, "${recordA.number}", Long.class); Long result = ve.getValue(context); Assert.assertEquals(LONG_DATA, result.longValue()); } }
Detected license expression
apache-2.0
Detected license expression (SPDX)
Apache-2.0
Percentage of license text
40.75
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