title: @SuppressStaticInitializationFor partial mocking
body: <p>I have this weird case where I want to test "some" functionality without touching the other... it's very hard for me to choose a proper description and I hope that the code I will present below is pretty much self descriptive. </p>
  
  <p>Suppose I have a class that keeps some strategies:</p>
  
  <pre><code>class TypeStrategy {
  
        private static final CreateConsumer CREATE_CONSUMER = new CreateConsumer();
        private static final ModifyConsumer MODIFY_CONSUMER = new ModifyConsumer();
  
        private static final Map&lt;Type, Consumer&lt;ConsumerContext&gt;&gt; MAP = Map.of(
                  Type.CREATE, CREATE_CONSUMER,
                  Type.MODIFY, MODIFY_CONSUMER
        );
  
        public static void consume(Type type, ConsumerContext context) {
             Optional.ofNullable(MAP.get(nodeActionType))
                     .orElseThrow(strategyMissing(type))
                     .accept(context);
        }
  }
  </code></pre>
  
  <p>The idea is very easy - there are some strategies that are registered for a certain <code>Type</code>; method <code>consume</code> will simply try to find a proper registered type and invoke <code>consume</code> on it with the supplied <code>ConsumerContext</code>.</p>
  
  <p>And now the problem: I very much want to test that all the strategies I care about are registered and I can invoke <code>accept</code> on them - that is literally all I want to test.</p>
  
  <p>Usually, I would use <code>@SuppressStaticInitializationFor</code> on the <code>TypeStrategy</code> and using <code>WhiteBox::setInternalState</code> would just put whatever I need for <code>CREATE_CONSUMER</code> and <code>MODIFY_CONSUMER</code>; but in this case I can't, because the <code>MAP</code> will be skipped also and I really don't want that, all I care about is those two strategies - I <em>need</em> the <code>MAP</code> to stay as it is.</p>
  
  <p>Besides some nasty refactoring, that does get me where I sort of want to be, I am out of ideas how can I achieve this. In the best case scenario I hoped that <code>@SuppressStaticInitializationFor</code> would support some "partial" skipping, where you could specify some filter on what exactly you want skipped , but that is not an option, really. </p>
  
  <p>I could also test "everything" else on the chain of calls - that is test everything that <code>accept</code> is supposed to do, but that adds close to 70 lines of mocking in this test and it becomes a nightmare to understand that it really wants to test a very small piece.</p>