package hu.advancedweb.example;

import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import org.junit.Rule;
import org.junit.Test;

import hu.advancedweb.scott.runtime.ScottReportingRule;

public class ListTest {
	
	@Rule public ScottReportingRule rule = new ScottReportingRule();
	
	@Test
	public void myTest() {
		Integer[] myArray = new Integer[] { 1, 4, 2, 4 };
		List<Integer> myList = Arrays.asList(myArray);
		
		Set<Integer> mySet = new HashSet<>(myList);
		mySet.remove(4);

		assertTrue(mySet.contains(4));
	}
	
	@Test
	public void test_1() {
		Integer[] myArray = new Integer[] { 1, 4, 2, 4 };
		List<Integer> myList = Arrays.asList(myArray);
		
		Set<Integer> mySet = new HashSet<Integer>(myList);
		mySet.remove(1);

		assertEquals(myList.size(), mySet.size());
	}
	
	@Test
	public void test_2() throws Throwable {
		Integer[] array = new Integer[] { 1, 4, 2, 3 };
		List<Integer> list = Arrays.asList(array);
		Collections.sort(list);

		assertArrayEquals(array, new Integer[] { 1, 4, 2, 3 });
	}
	
	// FIXME
	@Test
	public void test_3() {
		try {
			String a = null;
			System.out.println(a);
			a.getBytes();
		} catch (Exception e) {
			// FIXME: bug: determined scope of 'a' somehow contains the catch block too
			System.out.println(e);
		}
		String a = "";
		System.out.println(a);
		assertEquals(1, 2);
	}
	
}

@@ -1224,322 +1224,6 @@
 %7D%0A%09%0A
-%09// FIXME%0A%09@Test%0A%09public void test_3() %7B%0A%09%09try %7B%0A%09%09%09String a = null;%0A%09%09%09System.out.println(a);%0A%09%09%09a.getBytes();%0A%09%09%7D catch (Exception e) %7B%0A%09%09%09// FIXME: bug: determined scope of 'a' somehow contains the catch block too%0A%09%09%09System.out.println(e);%0A%09%09%7D%0A%09%09String a = %22%22;%0A%09%09System.out.println(a);%0A%09%09assertEquals(1, 2);%0A%09%7D%0A%09%0A
 %7D%0A

Remove bad example