/// Generates a `RegistryClient` that produces the given response when queried
/// for the node record of the given node.
///
/// Ideally we would have `MockRegistryClient` also implement the
/// `NodeRegistry` trait, but `mockall` chokes on it due to `NodeRegistry`
/// providing an implementation of `get_transport_info`, which conflicts with
/// that generated by `mockall`. Meaning we have to return bytes instead.
Generates a `RegistryClient` that produces the given response when queried
for the node record of the given node.


Generates a ` RegistryClient ` that produces the given response when queried for the node record of the given node .
fn registry_returning(
    node_id: NodeId,
    response: RegistryClientResult<Vec<u8>>,
) -> Arc<dyn RegistryClient> {
    let mut registry = MockRegistryClient::new();
    registry
        .expect_get_latest_version()
        .return_const(REGISTRY_VERSION);
    registry
        .expect_get_value()
        .withf(move |key, version| {
            key == make_node_record_key(node_id).as_str() && version == &REGISTRY_VERSION
        })
        .return_const(response);
    Arc::new(registry)
}
fn registry_returning ( node_id : NodeId , response : RegistryClientResult < Vec < u8 > > , ) -> Arc < dyn RegistryClient > { let mut registry = MockRegistryClient :: new ( ) ; registry . expect_get_latest_version ( ) . return_const ( REGISTRY_VERSION ) ; registry . expect_get_value ( ) . withf ( move | key , version | { key == make_node_record_key ( node_id ) . as_str ( ) && version == & REGISTRY_VERSION } ) . return_const ( response ) ; Arc :: new ( registry ) }
Generates a `RegistryClient` that produces the given response when queried
for the node record of the given node.
Generates a ` RegistryClient ` that produces the given response when queried for the node record of the given node .
node_id
NodeId
response
RegistryClientResult<Vec<u8>>