### Question:
CommonOptions { private void handleChown() { if (osUserAndGroup.length != 2) { throw new IllegalArgumentException(Utils.getMessage("IMG-0027")); } Pattern p = Pattern.compile("^[a-z_]([a-z0-9_-]{0,31}|[a-z0-9_-]{0,30}\\$)$"); Matcher usr = p.matcher(osUserAndGroup[0]); if (!usr.matches()) { throw new IllegalArgumentException(Utils.getMessage("IMG-0028", osUserAndGroup[0])); } Matcher grp = p.matcher(osUserAndGroup[1]); if (!grp.matches()) { throw new IllegalArgumentException(Utils.getMessage("IMG-0029", osUserAndGroup[1])); } dockerfileOptions.setUserId(osUserAndGroup[0]); dockerfileOptions.setGroupId(osUserAndGroup[1]); }  void copyOptionsFromImage(String fromImage, String tmpDir);  }### Answer:
@Test void handleChown() throws Exception { CreateImage createImage = new CreateImage(); Field optionsField = CommonOptions.class.getDeclaredField("dockerfileOptions"); optionsField.setAccessible(true); DockerfileOptions dockerfile = new DockerfileOptions("testbuildid"); optionsField.set(createImage, dockerfile); Field userAndGroupField = CommonOptions.class.getDeclaredField("osUserAndGroup"); userAndGroupField.setAccessible(true); String[] userAndGroup = {"derek", "data"}; userAndGroupField.set(createImage, userAndGroup); Method chownMethod = CommonOptions.class.getDeclaredMethod("handleChown"); chownMethod.setAccessible(true); chownMethod.invoke(createImage); assertEquals("derek", dockerfile.userid(), "CommonOptions handleChown failed to process user"); assertEquals("data", dockerfile.groupid(), "CommonOptions handleChown failed to process group"); }