@Override protected JobContext createNewContext(JobExecution execution, BatchPropertyContext args) { return new JobContext(execution); }
@Test public void testNullJobExecution() { try { context = new JobContext(null); fail("Expected IllegalArgumentException"); } catch (IllegalArgumentException e) { // expected } }
@Test public void testEqualsContextWithSameJobExecution() { assertEquals(new JobContext(jobExecution), context); }
@Before public void setUp() { jobExecution = new JobExecution(1L); JobInstance jobInstance = new JobInstance(2L, "job"); jobExecution.setJobInstance(jobInstance); context = new JobContext(jobExecution); list = new ArrayList<>(); }
@Test public void testGetJobExecution() { context = new JobContext(jobExecution); assertNotNull(context.getJobExecution()); }
@Test(expected = IllegalStateException.class) public void testIllegalContextId() throws Exception { context = new JobContext(new JobExecution((Long) null)); context.getId(); }
@Test public void testJobParameters() throws Exception { JobParameters jobParameters = new JobParametersBuilder().addString("foo", "bar").toJobParameters(); JobInstance jobInstance = new JobInstance(0L, "foo"); jobExecution = new JobExecution(5L, jobParameters); jobExecution.setJobInstance(jobInstance); context = new JobContext(jobExecution); assertEquals("bar", context.getJobParameters().get("foo")); }
@Override protected JobContext createNewContext(JobExecution execution, BatchPropertyContext args) { return new JobContext(execution); }
@Override protected JobContext createNewContext(JobExecution execution, BatchPropertyContext args) { return new JobContext(execution); }
@Override protected JobContext createNewContext(JobExecution execution, BatchPropertyContext args) { return new JobContext(execution); }