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-net.git
The following commit(s) were added to refs/heads/master by this push: new 91cc96e0 Add missing tests 91cc96e0 is described below commit 91cc96e0d1713bbd06d9d4cdaa582a72d74c1e10 Author: Gary Gregory <garydgreg...@gmail.com> AuthorDate: Mon May 27 17:45:49 2024 -0400 Add missing tests --- .../org/apache/commons/net/util/CharsetsTest.java | 40 ++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/src/test/java/org/apache/commons/net/util/CharsetsTest.java b/src/test/java/org/apache/commons/net/util/CharsetsTest.java new file mode 100644 index 00000000..6db3b512 --- /dev/null +++ b/src/test/java/org/apache/commons/net/util/CharsetsTest.java @@ -0,0 +1,40 @@ +/* + * 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.commons.net.util; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +import java.nio.charset.StandardCharsets; + +import org.junit.jupiter.api.Test; + +/** + * Tests {@link Charsets}. + */ +public class CharsetsTest { + + @Test + public void testToCharset() { + assertEquals(StandardCharsets.UTF_8, Charsets.toCharset(StandardCharsets.UTF_8.name())); + } + + @Test + public void testToCharsetDefault() { + assertEquals(StandardCharsets.UTF_8, Charsets.toCharset(null, StandardCharsets.UTF_8.name())); + } +}