My original code looked like this:
SpecificEntity result = broker.changeSpecificEntity ( myTestKey , myTestData ) ;
"broker" is an (interface/implementation facade) with several methods (create, change, remove, etc) for each of many entity types.
I want to implement a generic version of the code so I don't have to repeat myself. There is more code than shown here, but the rest is already generic.
This is what we have so far.
public < K extends Key , D extends Data > D changeAnyEntity ( final K testKey, final D testData, BiFunction<K, D, D> brokerMethod )
{
return brokerMethod.apply ( testKey , testData ) ;
}
Now I need to invoke a generic method, (e.g., changeAnyEntity) for each of the methods under test.
SpecificEntity result = changeAnyEntity ( myTestKey , myTestData , myBrokerFuncion )
I have not yet figured out how to define / create "myBrokerFunction"