package io.avengers.service;

import static org.junit.Assert.*;

import org.junit.After;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;

import java.sql.Connection;
import java.sql.SQLException;

public class HeroServiceTest {

	HeroService heroService;

	
	
	@Before
	public void setUp() throws Exception {
		heroService= new HeroService();
		
	}

	@After
	public void tearDown() throws Exception {
	}

	@Test
	public void testFindAll() {
		assertTrue(heroService.findAll().size()>1);
		assertFalse(heroService.findAll().size()<0);
	}
	@Ignore
	@Test
	public void testFindHeroesByName(){
		assertTrue(heroService.findHeroesByName("Spider").size()==1);
		;
	}

}

@@ -161,24 +161,59 @@
 it.Test;%0D%0A%0D%0A
+import io.avengers.domain.Hero;%0D%0A%0D%0A
 import java.
@@ -326,16 +326,50 @@
 ce;%0D%0A%0D%0A%09
+Hero test = new Hero(0,%22tonton1%22);
 %0D%0A%09%0D%0A%09@B
@@ -662,15 +662,8 @@
 %7D%0D%0A%09
-@Ignore
 %0D%0A%09@
@@ -773,20 +773,532 @@
 =1);%0D%0A%09%09
-;%0D%0A%09%7D%0D%0A
+assertTrue((heroService.findHeroesByName(%22Spider%22).iterator().next()).getName().contains(%22i%22));%0D%0A%09%09%0D%0A%09%7D%0D%0A%09@Test%0D%0A%09public void testFindHeroesById() throws SQLException%7B%0D%0A%09%09assertTrue(heroService.findHeroesById(1).getName().equals(%22Spiderman%22));%0D%0A%09%09assertFalse(heroService.findHeroesById(1).getName().equals(%22Hulk%22));%0D%0A%09%7D%0D%0A%09@Test%0D%0A%09public void testNewHero() throws SQLException %7B%0D%0A%09%09Hero hero=heroService.createHero(test);%0D%0A%09%09hero.setIrl(%22tururu%22);%0D%0A%09%09assertTrue(hero.getId()!=0);%0D%0A%09%09heroService.deleteHero(hero);%0D%0A%09%09%0D%0A%09%7D
 %0D%0A%7D%0D%0A

test service hero dao