public static String cloudIdEncode(String... args) {
        final String joinedArgs = String.join("$", args);
        return Base64.getUrlEncoder().encodeToString(joinedArgs.getBytes());
    }
@Test
    public void testThrowExceptionWhenMalformedValueIsGiven() {
        String[] raw = new String[] {"first", "second"};
        String encoded = CloudSettingId.cloudIdEncode(raw);

        Exception thrownException = assertThrows(org.jruby.exceptions.ArgumentError.class, () -> {
            new CloudSettingId(encoded);
        });
        assertThat(thrownException.getMessage(), containsString("Cloud Id, after decoding, is invalid. Format: '<segment1>$<segment2>$<segment3>'. Received: \"" + String.join("$", raw) + "\"."));
    }