@Override
    public void doAdmissionChecks(AppsV1Api appsV1Api, CoreV1Api coreV1Api, String jobNamespace, String jobName,
                                  Function.FunctionDetails functionDetails) {
        if (!StringUtils.isEmpty(functionDetails.getSecretsMap())) {
            Type type = new TypeToken<Map<String, Object>>() {
            }.getType();
            Map<String, Object> secretsMap = new Gson().fromJson(functionDetails.getSecretsMap(), type);

            for (Object object : secretsMap.values()) {
                if (object instanceof Map) {
                    Map<String, String> kubernetesSecret = (Map<String, String>) object;
                    if (kubernetesSecret.size() < 2) {
                        throw new IllegalArgumentException("Kubernetes Secret should contain id and key");
                    }
                    if (!kubernetesSecret.containsKey(idKey)) {
                        throw new IllegalArgumentException("Kubernetes Secret should contain id information");
                    }
                    if (!kubernetesSecret.containsKey(keyKey)) {
                        throw new IllegalArgumentException("Kubernetes Secret should contain key information");
                    }
                } else {
                    throw new IllegalArgumentException("Kubernetes Secret should be a Map containing id/key pairs");
                }
            }
        }
    }
@Test
    public void testConfigValidation() throws Exception {
        KubernetesSecretsProviderConfigurator provider = new KubernetesSecretsProviderConfigurator();
        try {
            HashMap<String, Object> map = new HashMap<String, Object>();
            map.put("secretname", "randomsecret");
            Function.FunctionDetails functionDetails = Function.FunctionDetails.newBuilder().setSecretsMap(new Gson().toJson(map)).build();
            provider.doAdmissionChecks(null, null, null, null, functionDetails);
            Assert.fail("Non conforming secret object should not validate");
        } catch (Exception e) {
        }
        try {
            HashMap<String, Object> map = new HashMap<String, Object>();
            HashMap<String, String> map1 = new HashMap<String, String>();
            map1.put("secretname", "secretvalue");
            map.put("secretname", map1);
            Function.FunctionDetails functionDetails = Function.FunctionDetails.newBuilder().setSecretsMap(new Gson().toJson(map)).build();
            provider.doAdmissionChecks(null, null, null, null, functionDetails);
            Assert.fail("Non conforming secret object should not validate");
        } catch (Exception e) {
        }
        try {
            HashMap<String, Object> map = new HashMap<String, Object>();
            HashMap<String, String> map1 = new HashMap<String, String>();
            map1.put("path", "secretvalue");
            map1.put("key", "secretvalue");
            map.put("secretname", map1);
            Function.FunctionDetails functionDetails = Function.FunctionDetails.newBuilder().setSecretsMap(new Gson().toJson(map)).build();
            provider.doAdmissionChecks(null, null, null, null, functionDetails);
        } catch (Exception e) {
            Assert.fail("Conforming secret object should validate");
        }
    }