From 0c1b76c5f312ad151fcc4e2de18acfc8faa70a6f Mon Sep 17 00:00:00 2001 From: Looly Date: Wed, 14 Jun 2023 11:16:46 +0800 Subject: [PATCH] add test --- .../cn/hutool/core/convert/ToBytesTest.java | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100755 hutool-core/src/test/java/cn/hutool/core/convert/ToBytesTest.java diff --git a/hutool-core/src/test/java/cn/hutool/core/convert/ToBytesTest.java b/hutool-core/src/test/java/cn/hutool/core/convert/ToBytesTest.java new file mode 100755 index 000000000..c3ee3c75d --- /dev/null +++ b/hutool-core/src/test/java/cn/hutool/core/convert/ToBytesTest.java @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2023 looly(loolly@aliyun.com) + * Hutool is licensed under Mulan PSL v2. + * You can use this software according to the terms and conditions of the Mulan PSL v2. + * You may obtain a copy of Mulan PSL v2 at: + * http://license.coscl.org.cn/MulanPSL2 + * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, + * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, + * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. + * See the Mulan PSL v2 for more details. + */ + +package cn.hutool.core.convert; + +import org.junit.Assert; +import org.junit.Test; + +import java.util.ArrayList; +import java.util.List; + +public class ToBytesTest { + @Test + public void toBytesTest() { + final List byteList = new ArrayList<>(); + byteList.add((byte) 1); + byteList.add((byte) 2); + byteList.add((byte) 3); + + final byte[] bytes = Convert.convert(byte[].class, byteList); + Assert.assertEquals(1, bytes[0]); + Assert.assertEquals(2, bytes[1]); + Assert.assertEquals(3, bytes[2]); + } +}