1/*2 * Licensed to the Apache Software Foundation (ASF) under one or more3 * contributor license agreements. See the NOTICE file distributed with4 * this work for additional information regarding copyright ownership.5 * The ASF licenses this file to You under the Apache License, Version 2.06 * (the "License"); you may not use this file except in compliance with7 * the License. You may obtain a copy of the License at8 *9 * https://www.apache.org/licenses/LICENSE-2.010 *11 * Unless required by applicable law or agreed to in writing, software12 * distributed under the License is distributed on an "AS IS" BASIS,13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.14 * See the License for the specific language governing permissions and15 * limitations under the License.16 */1718package org.apache.commons.codec;
1920importstatic org.junit.jupiter.api.Assertions.assertEquals;
21importstatic org.junit.jupiter.api.Assertions.assertNull;
2223import org.junit.jupiter.api.Test;
2425/**26 * Tests {@link EncoderException}.27 */28classEncoderExceptionTest {
2930privatestaticfinal String MSG = "TEST";
3132privatestaticfinal Throwable t = new Exception();
3334 @Test
35void testConstructor0() {
36final EncoderException e = new EncoderException();
37 assertNull(e.getMessage());
38 assertNull(e.getCause());
39 }
4041 @Test
42void testConstructorString() {
43final EncoderException e = new EncoderException(MSG);
44 assertEquals(MSG, e.getMessage());
45 assertNull(e.getCause());
46 }
4748 @Test
49void testConstructorStringThrowable() {
50final EncoderException e = new EncoderException(MSG, t);
51 assertEquals(MSG, e.getMessage());
52 assertEquals(t, e.getCause());
53 }
5455 @Test
56void testConstructorThrowable() {
57final EncoderException e = new EncoderException(t);
58 assertEquals(t.getClass().getName(), e.getMessage());
59 assertEquals(t, e.getCause());
60 }
6162 }