package ee.iglu.dao;

import static org.hamcrest.Matchers.*;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.fail;

import java.util.List;

import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.test.context.jdbc.Sql;
import org.springframework.test.context.junit4.SpringRunner;

@Sql
@RunWith(SpringRunner.class)
@SpringBootTest
public class ConstructorRowMapperTest {

	@Autowired
	private JdbcTemplate jdbcTemplate;

	@Test
	public void row_mapper_returns_populated_objects() {
		ConstructorRowMapper<SimpleRow> rowMapper = new ConstructorRowMapper<>(SimpleRow.class);

		List<SimpleRow> rows = jdbcTemplate.query("SELECT * FROM simple", rowMapper);

		assertThat(rows, hasSize(greaterThan(0)));
		SimpleRow row = rows.get(0);
		assertThat(row, notNullValue());
		assertThat(row.getId(), equalTo(10L));
		assertThat(row.getText(), equalTo("lorem ipsum..."));
	}

	@Test
	@Ignore
	public void failing_test() {
		fail("EPIC FAIL!");
	}
}

@@ -101,94 +101,32 @@
 at;%0A
-import static org.junit.Assert.fail;%0A%0Aimport java.util.List;%0A%0Aimport org.junit.Ignore;
+%0Aimport java.util.List;%0A
 %0Aimp
@@ -1055,77 +1055,6 @@
 %09%7D%0A%0A
-%09@Test%0A%09@Ignore%0A%09public void failing_test() %7B%0A%09%09fail(%22EPIC FAIL!%22);%0A%09%7D%0A
 %7D%0A

remove dummy test