@Override public void propertyDeleted(PropertyState before) throws CommitFailedException { String name = before.getName(); if (checkThisNode && effective.isMandatoryProperty(name)) { constraintViolation( 22, "Mandatory property " + name + " can not be removed"); } }
@Override public void propertyDeleted(PropertyState before) throws CommitFailedException { String name = before.getName(); if (checkThisNode && effective.isMandatoryProperty(name)) { constraintViolation( 22, "Mandatory property " + name + " can not be removed"); } }
@Override public void propertyDeleted(PropertyState before) throws CommitFailedException { String name = before.getName(); if (checkThisNode && effective.isMandatoryProperty(name)) { constraintViolation( 22, "Mandatory property " + name + " can not be removed"); } }
@Test(expected = CommitFailedException.class) public void removeMandatoryProperty() throws CommitFailedException { EffectiveType effective = createControl().createMock(EffectiveType.class); expect(effective.isMandatoryProperty("mandatory")).andReturn(true); expect(effective.getDirectTypeNames()).andReturn(Collections.emptyList()); replay(effective); TypeEditor editor = new TypeEditor(effective); editor.propertyDeleted(PropertyStates.createProperty("mandatory", "")); }
@Test public void removeNonMandatoryProperty() throws CommitFailedException { EffectiveType effective = createControl().createMock(EffectiveType.class); expect(effective.isMandatoryProperty("mandatory")).andReturn(false); replay(effective); TypeEditor editor = new TypeEditor(effective); editor.propertyDeleted(PropertyStates.createProperty("mandatory", "")); }