コード例 #1
0
  @Test
  public void testImmutability() {
    String coords = "gid:aid:ext:cls:ver";
    HashMap<String, String> map = new HashMap<String, String>();
    map.put("someProperty", "someValue");

    Artifact a = new DefaultArtifact(coords);
    assertNotSame(a, a.setFile(new File("file")));
    assertNotSame(a, a.setVersion("otherVersion"));
    assertNotSame(a, a.setProperties(map));
  }