This is an automated email from the ASF dual-hosted git repository. ggregory pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-compress.git
The following commit(s) were added to refs/heads/master by this push: new 42dcbdfd3 Add missing test class 42dcbdfd3 is described below commit 42dcbdfd3944ef177cd80aa049c3795abcc49c8a Author: Gary D. Gregory <garydgreg...@gmail.com> AuthorDate: Sat Jan 4 09:38:15 2025 -0500 Add missing test class --- .../commons/compress/MemoryLimitExceptionTest.java | 49 ++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/src/test/java/org/apache/commons/compress/MemoryLimitExceptionTest.java b/src/test/java/org/apache/commons/compress/MemoryLimitExceptionTest.java new file mode 100644 index 000000000..216feefe9 --- /dev/null +++ b/src/test/java/org/apache/commons/compress/MemoryLimitExceptionTest.java @@ -0,0 +1,49 @@ +/* + * 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 + * + * https://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.commons.compress; + +import static org.junit.Assert.assertSame; +import static org.junit.jupiter.api.Assertions.assertEquals; + +import java.io.IOException; + +import org.junit.jupiter.api.Test; + +/** + * Tests {@link MemoryLimitException}. + */ +public class MemoryLimitExceptionTest { + + @Test + public void testAccessorsCause() { + final IOException ioe = new IOException(); + final MemoryLimitException e = new MemoryLimitException(1, 2, ioe); + assertEquals(1, e.getMemoryNeededInKb()); + assertEquals(2, e.getMemoryLimitInKb()); + assertSame(ioe, e.getCause()); + } + + @Test + public void testAccessorsLimit() { + final MemoryLimitException e = new MemoryLimitException(1, 2); + assertEquals(1, e.getMemoryNeededInKb()); + assertEquals(2, e.getMemoryLimitInKb()); + } +}