use of org.eclipse.scanning.sequencer.ScanRequestBuilder in project gda-core by openGDA.
the class MScanSubmitterTest method createsCorrectProcessorListForReRunFromFileAndSubmits.
@Test
public void createsCorrectProcessorListForReRunFromFileAndSubmits() throws Exception {
Object[] arr = { Action.RERUN, TEST_FILE };
doNothing().when(theFacadeInstance).runCommand(anyString());
try (final MockedStatic<ScanRequestBuilder> scanBuilder = mockStatic(ScanRequestBuilder.class)) {
ScanRequest request = new ScanRequest();
request.setCompoundModel(getCompoundModel(grid, circle));
scanBuilder.when(() -> ScanRequestBuilder.buildFromNexusFile(TEST_FILE)).thenReturn(Optional.of(request));
builder.buildAndSubmitBlockingScanRequest(arr);
}
List<IClauseElementProcessor> processors = captor.getValue();
assertThat(processors.size(), is(1));
assertThat(processors.get(0), instanceOf(ReRunFromFileElementProcessor.class));
assertThat(processors.get(0).getElement(), is(TEST_FILE));
assertThat(processors.get(0).getElementValue(), is(TEST_FILE));
verify(eventSubscriber).addListener(any(IScanListener.class));
verify(submitter).blockingSubmit(beanCaptor.capture());
ScanBean bean = beanCaptor.getValue();
assertThat(bean.getScanRequest().getCompoundModel(), is(equalTo(getBoundedCompoundModel(grid, circle))));
}
Aggregations