Class EurekaTestHelpers


  • public class EurekaTestHelpers
    extends Object
    • Constructor Detail

      • EurekaTestHelpers

        public EurekaTestHelpers()
    • Method Detail

      • resetStatsMonitor

        public static void resetStatsMonitor()
        THIS IS A TOTAL HACK!!!!!!!

        The StatsMonitor contains a protected static final ScheduledExecutorService that when Eureka is shut down gets shutdown. There is not a way to "reset" that executor to a new one on each test so we have to do this reflection hack to reset it.

        Why don't we use Mockito's mockStatic or PowerMock's mockStatic to mock the method in ServoControl which calls shutdown on the executor? Because...

        • Mockito's mockStatic does not support doNothing() which is needed because the method is void.
        • PowerMock doesn't support Junit 5 without "tricking" the runner to fall back to Junit 4 which is yuck!