@Override
    public void setConfigAttributes(Object attributes) {
        if (attributes == null) {
            return;
        }
        super.setConfigAttributes(attributes);
        Map map = (Map) attributes;
        if (map.containsKey(BRANCH)) {
            String branchName = (String) map.get(BRANCH);
            this.branch = isBlank(branchName) ? DEFAULT_BRANCH : branchName;
        }
        if (map.containsKey("userName")) {
            this.userName = (String) map.get("userName");
        }
        if (map.containsKey(PASSWORD_CHANGED) && "1".equals(map.get(PASSWORD_CHANGED))) {
            String passwordToSet = (String) map.get(PASSWORD);
            resetPassword(passwordToSet);
        }
        if (map.containsKey(URL)) {
            this.url = new UrlArgument((String) map.get(URL));
        }

        this.shallowClone = "true".equals(map.get(SHALLOW_CLONE));
    }
@Test
    void setConfigAttributes_shouldUpdatePasswordWhenPasswordChangedBooleanChanged() throws Exception {
        GitMaterialConfig gitMaterialConfig = git("");
        Map<String, String> map = new HashMap<>();
        map.put(GitMaterialConfig.PASSWORD, "secret");
        map.put(GitMaterialConfig.PASSWORD_CHANGED, "1");

        gitMaterialConfig.setConfigAttributes(map);
        assertNull(ReflectionUtil.getField(gitMaterialConfig, "password"));
        assertEquals("secret", gitMaterialConfig.getPassword());
        assertEquals(new GoCipher().encrypt("secret"), gitMaterialConfig.getEncryptedPassword());

        //Dont change
        map.put(GitMaterialConfig.PASSWORD, "Hehehe");
        map.put(GitMaterialConfig.PASSWORD_CHANGED, "0");
        gitMaterialConfig.setConfigAttributes(map);

        assertNull(ReflectionUtil.getField(gitMaterialConfig, "password"));
        assertEquals("secret", gitMaterialConfig.getPassword());
        assertEquals(new GoCipher().encrypt("secret"), gitMaterialConfig.getEncryptedPassword());

        map.put(GitMaterialConfig.PASSWORD, "");
        map.put(GitMaterialConfig.PASSWORD_CHANGED, "1");
        gitMaterialConfig.setConfigAttributes(map);

        assertNull(gitMaterialConfig.getPassword());
        assertNull(gitMaterialConfig.getEncryptedPassword());
    }