CommandInvocation { public String[] args() { return Arrays.copyOf(args, args.length); } CommandInvocation(final String command, final String... args); String command(); String[] args();  }
@Test public void testArgsImmutability() throws Exception { final CommandInvocation commandInvocation = new CommandInvocation("cmd", "a", "t"); commandInvocation.args()[1] = "b"; assertArrayEquals(new String[] { "a", "t" }, commandInvocation.args()); }