public static String sign(final String algorithmName, final String key, final String data) {
        if (Objects.isNull(key) || Objects.isNull(data)) {
            throw new NullPointerException("Key or data is null.");
        }

        return Optional.ofNullable(SIGN_FUNCTION_MAP.get(algorithmName))
                .orElseThrow(() -> new UnsupportedOperationException("unsupported sign algorithm:" + algorithmName))
                .sign(key, data);
    }
@Test
    public void testGeneratesSignWithNullKeyOrNullData() {

        assertThrowsExactly(NullPointerException.class,
            () -> SignUtils.sign(SignUtils.SIGN_HS256, "key", null));

        assertThrowsExactly(NullPointerException.class,
            () -> SignUtils.sign(SignUtils.SIGN_HS256, null, "data"));
    }