package de.retest.recheck.review.ignore.io;

import static org.assertj.core.api.Assertions.assertThat;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

import org.junit.jupiter.api.Test;

import de.retest.recheck.ignore.ShouldIgnore;

class LoadersTest {

	@Test
	void test() {
		final String[] lines = new String[] { //
				"# This is a comment", //
				"matcher: id=title, attribute: font", //
				"matcher: id=banner", //
				"matcher: retestid=banner", //
				"matcher: retestid=banner, attribute: outline", //
				"\t ", // this is an empty line with invisible whitespace chars
				"attribute=outline", //
				"matcher: xpath=/html[1]/div[1]/div[1]/div[1]", //
				"matcher: xpath=/html[1]/div[1]/div[1]/div[2], attribute: background-url" //
		};
		final List<ShouldIgnore> ignores = Loaders.load( Arrays.asList( lines ).stream() ) //
				.filter( ShouldIgnore.class::isInstance ) //
				.map( ShouldIgnore.class::cast ) //
				.collect( Collectors.toList() );
		assertThat( ignores.size() ).isEqualTo( 8 );

		assertThat( ignores.toString() ).isEqualTo( "[" //
				+ "# This is a comment, " //
				+ "matcher: id=title, attribute: font, " //
				+ "matcher: id=banner, " //
				+ "matcher: retestid=banner, " //
				+ "matcher: retestid=banner, attribute: outline, " //
				+ "attribute=outline, " //
				+ "matcher: xpath=/html[1]/div[1]/div[1]/div[1], " //
				+ "matcher: xpath=/html[1]/div[1]/div[1]/div[2], attribute: background-url" //
				+ "]" );
	}

}

@@ -222,55 +222,8 @@
 t;%0A%0A
-import de.retest.recheck.ignore.ShouldIgnore;%0A%0A
 clas
@@ -273,47 +273,41 @@
 nal 
+List%3C
 String
-%5B%5D lines = new String%5B%5D %7B //%0A%09%09%09%09
+%3E in = Arrays.asList( 
 %22# T
@@ -725,15 +725,11 @@
 rl%22 
-//%0A%09%09%7D;
+);%0A
 %0A%09%09f
@@ -743,699 +743,155 @@
 st%3CS
-houldIgnore%3E ignores = Loaders.load( Arrays.asList( lines ).stream() ) //%0A%09%09%09%09.filter( ShouldIgnore.class::isInstance ) //%0A%09%09%09%09.map( ShouldIgnore.class::cast ) //%0A%09%09%09%09.collect( Collectors.toList() );%0A%09%09assertThat( ignores.size() ).isEqualTo( 8 );%0A%0A%09%09assertThat( ignores.toString() ).isEqualTo( %22%5B%22 //%0A%09%09%09%09+ %22# This is a comment, %22 //%0A%09%09%09%09+ %22matcher: id=title, attribute: font, %22 //%0A%09%09%09%09+ %22matcher: id=banner, %22 //%0A%09%09%09%09+ %22matcher: retestid=banner, %22 //%0A%09%09%09%09+ %22matcher: retestid=banner, attribute: outline, %22 //%0A%09%09%09%09+ %22attribute=outline, %22 //%0A%09%09%09%09+ %22matcher: xpath=/html%5B1%5D/div%5B1%5D/div%5B1%5D/div%5B1%5D, %22 //%0A%09%09%09%09+ %22matcher: xpath=/html%5B1%5D/div%5B1%5D/div%5B1%5D/div%5B2%5D, attribute: background-url%22 //%0A%09%09%09%09+ %22%5D%22
+tring%3E out = Loaders.load( in.stream() ) //%0A%09%09%09%09.map( Object::toString ) //%0A%09%09%09%09.collect( Collectors.toList() );%0A%0A%09%09assertThat( out ).isEqualTo( in
  );%0A

Refactor test