ttomcat-1778514358873.zip-extract/apache-tomcat-11.0.18-src/test/org/apache/jasper/util/TestFastRemovalDequeue.java

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

      
    
Rootfs path

      
    
Size
5328 (5.2 KB)
MD5
681833fe9a264261fab957727db73e1f
SHA1
e961a636dadb872cd47e1db3624308a20f8da72e
SHA256
d06a4ca4b6890de94d3c37ad22c980de6615c76f57954970f696da7afa2877af
SHA512

      
    
SHA1_git
00e91b8cbceb33c29f5a0bf4d32e8a33f5ad79f1
Is binary

      
    
Is text
True
Is archive

      
    
Is media

      
    
Is legal

      
    
Is manifest

      
    
Is readme

      
    
Is top level

      
    
Is key file

      
    
TestFastRemovalDequeue.java | 5.2 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.jasper.util; import org.junit.Assert; import org.junit.Test; public class TestFastRemovalDequeue { @Test public void testSinglePushPop() throws Exception { FastRemovalDequeue<Object> q = new FastRemovalDequeue<>(2); Object o1 = new Object(); q.push(o1); Object r = q.pop(); Assert.assertEquals(o1, r); Assert.assertNull(q.first); Assert.assertNull(q.last); } @Test public void testDoublePushPop() throws Exception { FastRemovalDequeue<Object> q = new FastRemovalDequeue<>(2); Object o1 = new Object(); Object o2 = new Object(); q.push(o1); q.push(o2); Assert.assertEquals(o2, q.first.getContent()); Assert.assertEquals(o1, q.last.getContent()); Object r1 = q.pop(); Assert.assertEquals(o1, r1); Assert.assertEquals(o2, q.first.getContent()); Assert.assertEquals(o2, q.last.getContent()); Object r2 = q.pop(); Assert.assertEquals(o2, r2); Assert.assertNull(q.first); Assert.assertNull(q.last); } @Test public void testSingleUnpopPop() throws Exception { FastRemovalDequeue<Object> q = new FastRemovalDequeue<>(2); Object o1 = new Object(); q.unpop(o1); Object r = q.pop(); Assert.assertEquals(o1, r); Assert.assertNull(q.first); Assert.assertNull(q.last); } @Test public void testDoubleUnpopPop() throws Exception { FastRemovalDequeue<Object> q = new FastRemovalDequeue<>(2); Object o1 = new Object(); Object o2 = new Object(); q.unpop(o1); q.unpop(o2); Assert.assertEquals(o1, q.first.getContent()); Assert.assertEquals(o2, q.last.getContent()); Object r2 = q.pop(); Assert.assertEquals(o2, r2); Assert.assertEquals(o1, q.first.getContent()); Assert.assertEquals(o1, q.last.getContent()); Object r1 = q.pop(); Assert.assertEquals(o1, r1); Assert.assertNull(q.first); Assert.assertNull(q.last); } @Test public void testSinglePushUnpush() throws Exception { FastRemovalDequeue<Object> q = new FastRemovalDequeue<>(2); Object o1 = new Object(); q.push(o1); Object r = q.unpush(); Assert.assertEquals(o1, r); Assert.assertNull(q.first); Assert.assertNull(q.last); } @Test public void testDoublePushUnpush() throws Exception { FastRemovalDequeue<Object> q = new FastRemovalDequeue<>(2); Object o1 = new Object(); Object o2 = new Object(); q.push(o1); q.push(o2); Assert.assertEquals(o2, q.first.getContent()); Assert.assertEquals(o1, q.last.getContent()); Object r2 = q.unpush(); Assert.assertEquals(o2, r2); Assert.assertEquals(o1, q.first.getContent()); Assert.assertEquals(o1, q.last.getContent()); Object r1 = q.unpush(); Assert.assertEquals(o1, r1); Assert.assertNull(q.first); Assert.assertNull(q.last); } @Test public void testSinglePushRemove() throws Exception { FastRemovalDequeue<Object> q = new FastRemovalDequeue<>(2); Object o1 = new Object(); FastRemovalDequeue<Object>.Entry e1 = q.push(o1); Assert.assertEquals(o1, e1.getContent()); q.remove(e1); Assert.assertNull(q.first); Assert.assertNull(q.last); } @Test public void testDoublePushRemove() throws Exception { FastRemovalDequeue<Object> q = new FastRemovalDequeue<>(2); Object o1 = new Object(); Object o2 = new Object(); FastRemovalDequeue<Object>.Entry e1 = q.push(o1); FastRemovalDequeue<Object>.Entry e2 = q.push(o2); Assert.assertEquals(o1, e1.getContent()); Assert.assertEquals(o2, e2.getContent()); Assert.assertEquals(o2, q.first.getContent()); Assert.assertEquals(o1, q.last.getContent()); q.remove(e1); Assert.assertEquals(o2, q.first.getContent()); Assert.assertEquals(o2, q.last.getContent()); q.remove(e2); Assert.assertNull(q.first); Assert.assertNull(q.last); } }
Detected license expression
apache-2.0
Detected license expression (SPDX)
Apache-2.0
Percentage of license text
20.45
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