I have a bunch of Junit tests that derive from a base abstract class. In my test method in the base class, I want to be able to use a combination of one or multiple features (say, Feature1, Feature2, Feature3 etc.). That is, a test can use just Feature2, while another test can have all three.
public void test() throws Exception
{
if (feature1)
// do something1
if (feature2)
// do something2
if (feature3)
// do something3
// there can be more features
if (no feature used)
// do "default"
}
What would be the best choice of design pattern in this case? I am looking into the COMMAND pattern, but it appears that I can use one Command at any given time. My requirement is to be able to use anything between none to all commands/features.
Aucun commentaire:
Enregistrer un commentaire