@Override
    public void setConfigAttributes(Object attributes) {
        clear();
        if (attributes == null) {
            return;
        }
        Map attributeMap = (Map) attributes;
        String materialType = (String) attributeMap.get(AbstractMaterialConfig.MATERIAL_TYPE);
        if (SvnMaterialConfig.TYPE.equals(materialType)) {
            addMaterialConfig(getSvnMaterial(), (Map) attributeMap.get(SvnMaterialConfig.TYPE));
        } else if (HgMaterialConfig.TYPE.equals(materialType)) {
            addMaterialConfig(getHgMaterial(), (Map) attributeMap.get(HgMaterialConfig.TYPE));
        } else if (GitMaterialConfig.TYPE.equals(materialType)) {
            addMaterialConfig(getGitMaterial(), (Map) attributeMap.get(GitMaterialConfig.TYPE));
        } else if (P4MaterialConfig.TYPE.equals(materialType)) {
            addMaterialConfig(getP4Material(), (Map) attributeMap.get(P4MaterialConfig.TYPE));
        } else if (DependencyMaterialConfig.TYPE.equals(materialType)) {
            addMaterialConfig(getDependencyMaterial(), (Map) attributeMap.get(DependencyMaterialConfig.TYPE));
        } else if (TfsMaterialConfig.TYPE.equals(materialType)) {
            addMaterialConfig(getTfsMaterial(), (Map) attributeMap.get(TfsMaterialConfig.TYPE));
        } else if (PackageMaterialConfig.TYPE.equals(materialType)) {
            addMaterialConfig(getPackageMaterial(), (Map) attributeMap.get(PackageMaterialConfig.TYPE));
        } else if (PluggableSCMMaterialConfig.TYPE.equals(materialType)) {
            addMaterialConfig(getSCMMaterial(), (Map) attributeMap.get(PluggableSCMMaterialConfig.TYPE));
        }
    }
@Test
    public void shouldSetSvnConfigAttributesForMaterial() {
        MaterialConfigs materialConfigs = new MaterialConfigs();

        Map<String, Object> svnAttrMap = new HashMap<>();
        svnAttrMap.put(SvnMaterialConfig.URL, "foo");
        svnAttrMap.put(SvnMaterialConfig.USERNAME, "bar");
        svnAttrMap.put(SvnMaterialConfig.PASSWORD, "baz");
        svnAttrMap.put(SvnMaterialConfig.CHECK_EXTERNALS, false);

        Map<String, Object> attributeMap = new HashMap<>();
        attributeMap.put(AbstractMaterialConfig.MATERIAL_TYPE, SvnMaterialConfig.TYPE);
        attributeMap.put(SvnMaterialConfig.TYPE, svnAttrMap);
        materialConfigs.setConfigAttributes(attributeMap);

        assertThat(materialConfigs.first()).isEqualTo(svn("foo", "bar", "baz", false));
    }