void () { Artifact artifact = addArtifact("xxx"); long count = getModificationCount(); ModifiableArtifactModel model = getArtifactManager().createModifiableModel(); assertFalse(model.isModified()); assertSame(artifact, model.getArtifactByOriginal(artifact)); ModifiableArtifact modifiable = model.getOrCreateModifiableArtifact(artifact); assertNotNull(modifiable); assertEquals("xxx", modifiable.getName()); assertNotSame(modifiable, artifact); modifiable.setOutputPath("/aaa"); modifiable.setName("qqq"); assertThat(artifact.getOutputPath()).isEqualTo(getProject().getBasePath() + "/out/artifacts/xxx"); assertEquals("xxx", artifact.getName()); assertSame(modifiable, model.getOrCreateModifiableArtifact(artifact)); assertSame(modifiable, model.getOrCreateModifiableArtifact(modifiable)); assertSame(modifiable, assertOneElement(model.getArtifacts())); assertSame(modifiable, model.findArtifact("qqq")); assertNull(model.findArtifact("xxx")); assertSame(modifiable, model.getArtifactByOriginal(artifact)); assertTrue(model.isModified()); MyArtifactListener listener = subscribe(); commit(model); assertEquals("changed:xxx->qqq;", listener.clearMessages()); Artifact newArtifact = assertOneElement(getArtifacts()); assertEquals("qqq", newArtifact.getName()); assertEquals("/aaa", newArtifact.getOutputPath()); assertSame(newArtifact, artifact); assertTrue(getModificationCount() > count); }