This question already has an answer here:
- What is Double Brace initialization in Java? 13 answers
I saw syntax similar to following
new Expectations()
{
{
TestClass.getName();
returns("Hello World");
}
}
I know Expectations is abstract class, so is this the anonymous class having a instance block?
How it works? Which design pattern is used?
Thanks !!!
Aucun commentaire:
Enregistrer un commentaire