move verification so that test is in order (elastic/x-pack-elasticsearch#1504)

improves test by taking order of statuses into account

Original commit: elastic/x-pack-elasticsearch@0d214714d3
This commit is contained in:
Hendrik Muhs 2017-05-22 15:44:09 +02:00 committed by GitHub
parent 1873624a18
commit edc299a532
1 changed files with 1 additions and 2 deletions

View File

@ -338,13 +338,12 @@ public class AutodetectProcessManagerTests extends ESTestCase {
manager.processData(jobTask, createInputStream(""), randomFrom(XContentType.values()), mock(DataLoadParams.class),
(dataCounts1, e) -> {
});
verify(manager).setJobState(any(), eq(JobState.OPENED));
// job is created
assertEquals(1, manager.numberOfOpenJobs());
expectThrows(ElasticsearchException.class, () -> manager.closeJob(jobTask, false, null));
assertEquals(0, manager.numberOfOpenJobs());
verify(manager).setJobState(any(), eq(JobState.OPENED));
verify(manager).setJobState(any(), eq(JobState.FAILED));
}