### Question:
AbstractCommandArgs implements CommandArgs { @Override public float nextFloat() throws MissingArgumentException, ArgumentParseException { String next = next(); try { return Float.parseFloat(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 testNextBadFloat() throws Exception { CommandArgs args; args = createCommandArgs(ImmutableList.of("alpha")); assertThat(args.position(), is(0)); args.nextFloat(); }
@Test public void testNextFloat() throws Exception { CommandArgs args; args = createCommandArgs(ImmutableList.of("40.23")); assertThat(args.position(), is(0)); assertThat((double) args.nextFloat(), closeTo(40.23, 0.0001)); assertThat(args.position(), is(1)); }