Class TestConfigSupplier<M extends PMessage<M>>

  • Type Parameters:
    M - The message type.
    All Implemented Interfaces:
    java.util.function.Supplier<M>, ConfigSupplier<M>

    public class TestConfigSupplier<M extends PMessage<M>>
    extends UpdatingConfigSupplier<M>
    Config supplier meant for testing only. It is an updating config supplier, but that exposes the config update method itself.
    • Constructor Detail

      • TestConfigSupplier

        public TestConfigSupplier​(@Nonnull
                                  java.lang.String initialResource,
                                  PMessageDescriptor<M> descriptor)
                           throws ConfigException
        Start with an initial config value.
        Parameters:
        initialResource - The initial config value.
        descriptor - The message descriptor.
        Throws:
        ConfigException - If unable to load the config.
      • TestConfigSupplier

        public TestConfigSupplier​(@Nonnull
                                  M initialConfig)
        Start with an initial config value.
        Parameters:
        initialConfig - The initial config value.
      • TestConfigSupplier

        public TestConfigSupplier​(@Nonnull
                                  java.time.Clock clock,
                                  @Nonnull
                                  M initialConfig)
        Start with an initial config value.
        Parameters:
        clock - The clock to use for timing.
        initialConfig - The initial config value.
    • Method Detail

      • testUpdate

        public void testUpdate​(@Nonnull
                               M newInstance)
        Update the current config and trigger updates.
        Parameters:
        newInstance - The new config instance.
      • testUpdate

        public void testUpdate​(@Nonnull
                               java.lang.String resourceName)
                        throws ConfigException
        Update the current config and trigger updates.
        Parameters:
        resourceName - The new config resource name.
        Throws:
        ConfigException - If the loaded config is not valid.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • getName

        public java.lang.String getName()
        Description copied from interface: ConfigSupplier
        Get a simple descriptive name for this config supplier.
        Returns:
        The supplier name.