use of org.opennms.netmgt.provision.persist.LocationAwareRequisitionClient in project opennms by OpenNMS.
the class RequisitionUrlConnectionTest method canRetrieveRequisition.
@Test
public void canRetrieveRequisition() throws Exception {
Requisition expectedRequisition = new Requisition();
LocationAwareRequisitionClient client = mock(LocationAwareRequisitionClient.class, RETURNS_DEEP_STUBS);
when(client.requisition().withRequisitionProviderType("test").withParameters(any()).execute().get()).thenReturn(expectedRequisition);
try {
RequisitionUrlConnection.setClient(client);
final String requisitionAsStr = urlToString("requisition://test/");
Requisition actualRequisition = JaxbUtils.unmarshal(Requisition.class, requisitionAsStr);
assertEquals(expectedRequisition, actualRequisition);
} finally {
RequisitionUrlConnection.setClient(null);
}
}
Aggregations