### Question:
AbstractCommandArgs implements CommandArgs { @Override public int nextInt() throws MissingArgumentException, ArgumentParseException { String next = next(); try { return Integer.parseInt(next); } catch (NumberFormatException ignored) { throw new ArgumentParseException("Expected a number, got '" + next + "'"); } }  @Override int nextInt(); @Override short nextShort(); @Override byte nextByte(); @Override double nextDouble(); @Override float nextFloat(); @Override boolean nextBoolean();  }### Answer:
@Test(expected = ArgumentParseException.class) public void testNextBadInt() throws Exception { CommandArgs args; args = createCommandArgs(ImmutableList.of("alpha")); assertThat(args.position(), is(0)); args.nextInt(); }
@Test public void testNextInt() throws Exception { CommandArgs args; args = createCommandArgs(ImmutableList.of("4000")); assertThat(args.position(), is(0)); assertThat(args.nextInt(), is(4000)); assertThat(args.position(), is(1)); }