ttomcat-1778514358873.zip-extract/apache-tomcat-11.0.18-src/test/org/apache/el/util/TestMessageFactory.java

Path
ttomcat-1778514358873.zip-extract/apache-tomcat-11.0.18-src/test/org/apache/el/util/TestMessageFactory.java
Status
scanned
Type
file
Name
TestMessageFactory.java
Extension
.java
Programming language
Java
Mime type
text/x-Algol68
File type
Algol 68 source, ASCII text, with CRLF line terminators
Tag

      
    
Rootfs path

      
    
Size
2604 (2.5 KB)
MD5
fac03ff377d5fc16bba2c7f92f446048
SHA1
2039ab4f9e29f760b891cd73ce85628d72098259
SHA256
65332460e25a58089183a89fce8295a69e7441bb82196935cfe84b7ceaf36376
SHA512

      
    
SHA1_git
29cd3eb5917cc03619b4a719adff82ade51fabd3
Is binary

      
    
Is text
True
Is archive

      
    
Is media

      
    
Is legal

      
    
Is manifest

      
    
Is readme

      
    
Is top level

      
    
Is key file

      
    
TestMessageFactory.java | 2.5 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 org.apache.el.util; import java.math.BigDecimal; import java.util.ResourceBundle; import org.junit.Assert; import org.junit.Test; public class TestMessageFactory { private static final Integer ZERO = Integer.valueOf(0); MessageFactory messageFactory = new MessageFactory(ResourceBundle.getBundle("org.apache.el.util.TestStrings")); @Test public void testFormatNone() { String input = "1E+2"; // Trailing '0" is an extra Number argument, not printed by the // message pattern. It reflects the case when a translation has not // been updated with new arguments. String result = messageFactory.getInternal("messageFactory.formatNone", new BigDecimal(input), ZERO /*ignored*/); // Should be unchanged Assert.assertEquals(input, result); } @Test public void testFormatNumeric() { String input = "1E+2"; String result = messageFactory.getInternal("messageFactory.formatNumeric", new BigDecimal(input)); // Should be formatted as an integer Assert.assertEquals("100", result); } @Test public void testFormatChoice() { String input = "1E+2"; String result = messageFactory.getInternal("messageFactory.formatChoice", new BigDecimal(input), ZERO /*ignored*/); // Should be formatted as an integer Assert.assertEquals("100 is enough", result); } @Test public void testFormatNoArguments() { String input = "1E+2"; String result = messageFactory.getInternal("messageFactory.formatNoArguments", new BigDecimal(input), ZERO /*ignored*/); Assert.assertEquals("A message", result); } }
Detected license expression
apache-2.0
Detected license expression (SPDX)
Apache-2.0
Percentage of license text
41.03
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