@Test
@JiraBuildNumberDependent(BN_JIRA_4_4)
public void testUpdateComponent() {
final BasicComponent basicComponent = Iterables.get(client.getProjectClient().getProject("TST").claim()
.getComponents(), 0);
final Component component = client.getComponentClient().getComponent(basicComponent.getSelf()).claim();
final String newName = basicComponent.getName() + "updated";
Component adjustedComponent = new Component(component.getSelf(), component.getId(), newName, component
.getDescription(), component.getLead(), component.getAssigneeInfo());
Component updatedComponent = client.getComponentClient().updateComponent(basicComponent
.getSelf(), new ComponentInput(newName, null, null, null)).claim();
assertEquals(adjustedComponent, updatedComponent);
assertEquals(adjustedComponent, client.getComponentClient().getComponent(basicComponent.getSelf()).claim());
final String newDescription = "updated description";
adjustedComponent = new Component(component.getSelf(), component
.getId(), newName, newDescription, IntegrationTestUtil.USER1_60, component.getAssigneeInfo());
updatedComponent = client.getComponentClient().updateComponent(basicComponent
.getSelf(), new ComponentInput(null, newDescription, IntegrationTestUtil.USER1_60.getName(), null)).claim();
assertEquals(adjustedComponent, updatedComponent);
adjustedComponent = new Component(component.getSelf(), component
.getId(), newName, newDescription, IntegrationTestUtil.USER1_60,
new Component.AssigneeInfo(IntegrationTestUtil.USER1_60, AssigneeType.COMPONENT_LEAD, IntegrationTestUtil.USER1_60, AssigneeType.COMPONENT_LEAD, true));
updatedComponent = client.getComponentClient().updateComponent(basicComponent
.getSelf(), new ComponentInput(null, newDescription, IntegrationTestUtil.USER1
.getName(), AssigneeType.COMPONENT_LEAD)).claim();
assertEquals(adjustedComponent, updatedComponent);
// now with non-assignable assignee (thus we are inheriting assignee from project settings and component-level settings are ignored)
adjustedComponent = new Component(component.getSelf(), component
.getId(), newName, newDescription, IntegrationTestUtil.USER2_60,
new Component.AssigneeInfo(IntegrationTestUtil.USER2_60, AssigneeType.COMPONENT_LEAD, IntegrationTestUtil.USER_ADMIN_60, AssigneeType.PROJECT_DEFAULT, false));
updatedComponent = client.getComponentClient().updateComponent(basicComponent
.getSelf(), new ComponentInput(null, newDescription, IntegrationTestUtil.USER2