### Question:
IdentityEditController extends AbstractController implements Initializable { void setPrivate(boolean isPrivate) { privateToggle.setSelected(isPrivate); }  @Override void initialize(URL location, ResourceBundle resources); void onFinish(Runnable finishHandler);  }### Answer:
@Test public void saveButtonSwitchesLabels() throws Exception { controller.setPrivate(true); assertThat(controller.saveIdentity.getText(), equalTo("Save")); assertThat(controller.privateHint.getText(), equalTo("private description text")); assertThat(controller.privateLabel.getText(), equalTo("Private")); controller.setPrivate(false); assertThat(controller.saveIdentity.getText(), equalTo("Save & Publish")); assertThat(controller.privateHint.getText(), equalTo("private description text")); assertThat(controller.privateLabel.getText(), equalTo("Private")); }
@Test public void removesIdentityOnPrivateSave() throws Exception { identity.setUploadEnabled(true); createController(); controller.setPrivate(true); saveAndWait(); verify(indexService, never()).updateIdentity(identity, null); verify(indexService).removeIdentity(identity); }