All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.approvaltests.namer.NamedEnvironment Maven / Gradle / Ivy

There is a newer version: 24.9.0
Show newest version
package org.approvaltests.namer;

import com.spun.util.logger.SimpleLogger;

import java.util.Arrays;

public class NamedEnvironment implements AutoCloseable
{
  public NamedEnvironment(String info)
  {
    NamerFactory.setAdditionalInformation(info);
  }
  @Override
  public void close()
  {
    NamerFactory.getAndClearAdditionalInformation();
  }
  public boolean isCurrentEnvironmentValidFor(String... environment)
  {
    if (Arrays.asList(environment).contains(NamerFactory.getAdditionalInformation()))
    {
      return true;
    }
    else
    {
      SimpleLogger.message(
          String.format("Not valid for current environment: \"%s\"", NamerFactory.getAdditionalInformation()));
      return false;
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy