JRubyCaller { protected String[] addVersionToArgs(final String gemVersion, String[] unpackArgs) { if (StringUtils.isNotBlank(gemVersion)) { this.logger.info("Version : " + gemVersion); unpackArgs = ArrayUtils.addAll(unpackArgs, "-v", gemVersion); } else { this.logger.info("Version : Last"); } return unpackArgs; } JRubyCaller(final Logger logger); File unpack(final String gemName, final String gemVersion);  }
@Test public void addVersionToArgs_Last_Version() { final JRubyCaller jRubyCaller = new JRubyCaller(this.logger); final String[] args = jRubyCaller.addVersionToArgs(null, new String[0]); Assert.assertEquals(0, args.length); }
@Test public void addVersionToArgs_Specific_Version() { final JRubyCaller jRubyCaller = new JRubyCaller(this.logger); final String[] args = jRubyCaller.addVersionToArgs("1.0", new String[0]); Assert.assertEquals(2, args.length); Assert.assertEquals(args[0], "-v"); Assert.assertEquals(args[1], "1.0"); }