<commit_before>package de.codecentric.jbehave.junit.monitoring;

import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyZeroInteractions;

import java.io.PrintStream;
import java.util.ArrayList;
import java.util.List;

import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;

public class LoggerTest {

	@Mock
	PrintStream stream;

	private Logger logger;

	@Before
	public void setup() {
		logger = new Logger();
		MockitoAnnotations.initMocks(this);
		logger.logStream = stream;
	}

	@Test
	public void shouldLogNothingForLoglevelNull() {
		logger.info("Should be lost");
		verifyZeroInteractions(stream);
	}

	@Test
	public void shouldLogNothingForUnknownLogLevle() {
		setLevel("invalid");
		logger.info("Should be lost");
		verifyZeroInteractions(stream);
	}

	@Test
	public void shoudLogNothingForLogLevelNone() {
		setLevel("NONE");
		logger.info("lost info");
		logger.debug("lost debug");
		verifyZeroInteractions(stream);
	}

	@Test
	public void shouldLogInfoForInfo() {<commit_msg>Test was failing at first. Apparently in some random test order (from infinitest?), the system property was set to a value that enabled logging. Now unsetting the property in the test setup.<commit_after>package de.codecentric.jbehave.junit.monitoring;

import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyZeroInteractions;

import java.io.PrintStream;
import java.util.ArrayList;
import java.util.List;

import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;

public class LoggerTest {

	@Mock
	PrintStream stream;

	private Logger logger;

	@Before
	public void setup() {
		System.clearProperty(Logger.PROP_JJM_LOGLEVEL);
		logger = new Logger();
		MockitoAnnotations.initMocks(this);
		logger.logStream = stream;
	}

	@Test
	public void shouldLogNothingForLoglevelNull() {
		logger.info("Should be lost");
		verifyZeroInteractions(stream);
	}

	@Test
	public void shouldLogNothingForUnknownLogLevle() {
		setLevel("invalid");
		logger.info("Should be lost");
		verifyZeroInteractions(stream);
	}

	@Test
	public void shoudLogNothingForLogLevelNone() {
		setLevel("NONE");
		logger.info("lost info");
		logger.debug("lost debug");
		verifyZeroInteractions(stream);
	}

	@Test
	public void shouldLogInfoForInfo() {
{'fraction_non_alphanumeric': 0.1051745898190997, 'fraction_numerical': 0.0, 'mean_word_length': 5.427027027027027, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '139971', 'n_tokens_mistral': 785, 'n_tokens_neox': 736, 'n_words': 176}