void () { final MyProjectWideFacetListener listener = new MyProjectWideFacetListener(); final ProjectWideFacetListenersRegistry listenersRegistry = ProjectWideFacetListenersRegistry.getInstance(myProject); listenersRegistry.registerListener(MockFacetType.ID, listener); final MockFacet facet1 = addFacet("1"); assertEquals("firstAdded;added[1];", listener.getEvents()); final MockFacet facet2 = addFacet("2"); assertEquals("added[2];", listener.getEvents()); removeFacet(facet1); assertEquals("beforeRemoved[1];removed[1];", listener.getEvents()); removeFacet(facet2); assertEquals("beforeRemoved[2];removed[2];allRemoved;", listener.getEvents()); listenersRegistry.unregisterListener(MockFacetType.ID, listener); }