import static org.junit.jupiter.api.Assertions.*;

import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
import java.util.jar.Attributes.Name;

import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;

class AnimalTest {

	@Test
	@DisplayName("Test make noise inhertience")
	void animalMakeNoiseTest() {
		
		Wolf wolf = new Wolf("Fuzzy", 8);

    	ByteArrayOutputStream baos = new ByteArrayOutputStream();
    	PrintStream ps = new PrintStream(baos);
    	PrintStream old = System.out;
    	System.setOut(ps);
    	wolf.makeNoise();
    	System.out.flush();
    	System.setOut(old);
    	
    	String w_noise = baos.toString();
    	
		assertTrue(w_noise.length()>0, "Testing that noise is printed");
		
		Parrot parrot = new Parrot("Squawker", 5);
		
    	baos = new ByteArrayOutputStream();
    	ps = new PrintStream(baos);
    	old = System.out;
    	System.setOut(ps);
    	parrot.makeNoise();
    	System.out.flush();
    	System.setOut(old);
    	
    	String p_noise = baos.toString();
    	
		assertTrue(p_noise.length()>0, "Testing that parrot is printed");
		assertFalse(p_noise.equals(p_noise), "Testing that a parraot and wolf make different noises");
		
	}
	
	
}
