public static String cloudIdEncode(String... args) {
        final String joinedArgs = String.join("$", args);
        return Base64.getUrlEncoder().encodeToString(joinedArgs.getBytes());
    }
@Test
    public void testThrowExceptionWhenElasticSegmentSegmentIsUndefined() {
        String[] raw = new String[] {"us-east-1.aws.found.io", "undefined", "my-kibana"};
        String encoded = CloudSettingId.cloudIdEncode(raw);

        Exception thrownException = assertThrows(org.jruby.exceptions.ArgumentError.class, () -> {
            new CloudSettingId(encoded);
        });
        assertThat(thrownException.getMessage(), containsString("Cloud Id, after decoding, elasticsearch segment is 'undefined', literally."));
    }