package de.retest.recheck.review.workers;

import static org.junit.Assert.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertThrows;

import java.io.File;
import java.io.IOException;
import java.nio.file.Path;

import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.io.TempDir;

import com.google.common.base.Charsets;
import com.google.common.io.Files;

import de.retest.recheck.configuration.ProjectConfiguration;
import de.retest.recheck.review.counter.NopCounter;

public class LoadFilterWorkerTest {

	@Test
	void loading_without_ignore_file_should_fail( @TempDir final Path root ) throws Exception {
		final LoadFilterWorker worker = new LoadFilterWorker( NopCounter.getInstance(), root.toFile() );
		assertThrows( IllegalArgumentException.class, () -> worker.load() );
	}

	@Test
	void loading_with_ignore_file_should_succeed( @TempDir final Path root ) throws Exception {

		givenFileWithLines( root.resolve( ProjectConfiguration.RECHECK_IGNORE ).toFile(), "#" );

		final LoadFilterWorker worker = new LoadFilterWorker( NopCounter.getInstance(), root.toFile() );
		assertNotNull( worker.load() );
	}

	private static void givenFileWithLines( final File file, final String lines ) throws IOException {
		Files.asCharSink( file, Charsets.UTF_8 ).write( lines );
	}
}

@@ -58,34 +58,46 @@
 org.
-junit
+assertj.core.api
 .Assert
+ions
 .assert
-NotNull
+That
 ;%0Aim
@@ -108,37 +108,36 @@
  static org.
-junit.jupiter
+assertj.core
 .api.Asserti
@@ -148,20 +148,26 @@
 assertTh
-rows
+atThrownBy
 ;%0A%0Aimpor
@@ -755,65 +755,143 @@
 rtTh
-rows( IllegalArgumentException.class, () -%3E worker.load()
+atThrownBy( worker::load ) //%0A%09%09%09%09.isExactlyInstanceOf( IllegalArgumentException.class ) //%0A%09%09%09%09.hasMessage( %22No recheck.ignore found.%22
  );%0A
@@ -994,17 +994,16 @@
 ption %7B%0A
-%0A
 %09%09givenF
@@ -1085,17 +1085,16 @@
  %22#%22 );%0A
-%0A
 %09%09final 
@@ -1196,15 +1196,12 @@
 sert
-NotNull
+That
 ( wo
@@ -1212,16 +1212,28 @@
 .load() 
+).isNotNull(
 );%0A%09%7D%0A%0A%09

Use AssertJ