@SuppressWarnings("unchecked")
  private void assertion(Map map, int expectedlayers) {
    RenderManager renderManagerInternal = map.getRenderManagerInternal();
    List<IRenderer> renderer = renderManagerInternal.getRenderers();
    for (IRenderer renderer2 : renderer) {
      assertNotNull(renderer2.getContext());
    }

    final int[] countedRenderers = new int[1];
    countedRenderers[0] = 0;
    renderManagerInternal
        .getRenderExecutor()
        .visit(
            new ExecutorVisitor() {

              public void visit(RenderExecutor executor) {
                countedRenderers[0]++;
              }

              public void visit(RenderExecutorMultiLayer executor) {
                countedRenderers[0]++;
              }

              public void visit(RenderExecutorComposite executor) {
                for (RenderExecutor child : executor.getRenderer().getRenderExecutors()) {
                  child.visit(this);
                }
              }
            });

    //		List<Layer> layers = map.getLayersInternal();
    //		for (Layer layer : layers) {
    //			int foundExecutor=0;
    //			List<Adapter> adapters = layer.eAdapters();
    //			for (Adapter adapter : adapters) {
    //				if( adapter instanceof RenderExecutorImpl.LayerListener ){
    //				foundExecutor++;
    //				if( foundExecutor>2 )
    //					fail("More than one RenderExecutor is registered with renderer"); //$NON-NLS-1$
    //			}
    //
    //			}
    //			if (foundExecutor==0)
    //				fail("A render executor should be listening to the layer: "+layer.getName());
    // //$NON-NLS-1$
    //		}
    assertEquals(expectedlayers, countedRenderers[0]);
  }
  private void assertBlank(RenderManager renderManagerInternal) {
    BufferedImage image = renderManagerInternal.getRenderExecutor().getContext().getImage();
    for (int x = 0; x < image.getWidth(); x++) {
      for (int y = 0; y < image.getHeight(); y++) {

        if (image.getRGB(x, y) != Color.WHITE.getRGB()) {
          fail("Image is not blank when it should be"); // $NON-NLS-1$
        }
      }
    }
  }