MetaJobRunnable implements JobRunnable { public int getMetaAsInt(final String key, final int defaultValue) { checkKey(key); final String value = getMetaAsString(key); return value != null ? Integer.valueOf(value) : defaultValue; } protected  MetaJobRunnable(final String jobType,
                              final JobMetaRepository metaRepository); final String getJobType(); final void deleteMeta(final String key); final void setMeta(final String key, final String value); final void setMeta(final String key, final int value); final void setMeta(final String key, final Integer value); final void setMeta(final String key, final long value); final void setMeta(final String key, final Long value); final void setMeta(final String key, final Instant value); final String getMetaAsString(final String key); final String getMetaAsString(final String key, final String defaultValue); int getMetaAsInt(final String key, final int defaultValue); final long getMetaAsLong(final String key, final long defaultValue); final Instant getMetaAsInstant(final String key); final Instant getMetaAsInstant(final String key, final Instant defaultValue);  }
@Test public void shouldGetJobMetaAsInt() { when(metaRepository.getValue("someJob", "key")).thenReturn("42"); final int value = testee.getMetaAsInt("key", -1); assertThat(value, is(42)); }