package gui.listeners;

import static org.junit.Assert.*;
import gui.graphics.ImageResize;
import java.awt.Dimension;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.io.InputStream;
import javax.imageio.ImageIO;
import org.junit.Before;
import org.junit.Test;

public class TestImageResize {
	private BufferedImage testImage;
	private Dimension dimensionToTest;
	private ImageResize ir = new ImageResize();
	
	@Before
	public void setUp() throws Exception {
		try {
			ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
			InputStream input = classLoader.getResourceAsStream("gui/graphics/svart.jpg");
			testImage = ImageIO.read(input);
		} catch (IOException e) {
			
		}
	}

	@Test
	public void HorisontalTest() {
		dimensionToTest = new Dimension(20, 40);
		testImage = ir.resizeImage(testImage, dimensionToTest);
		assertEquals(20, testImage.getWidth());
	}
	
	@Test
	public void VerticalTest() {
		dimensionToTest = new Dimension(40, 20);
		testImage = ir.resizeImage(testImage, dimensionToTest);
		assertEquals(20, testImage.getHeight());
	}
}

@@ -281,16 +281,53 @@
 it.Test;
+%0Aimport static org.mockito.Mockito.*;
 %0A%0Apublic
@@ -791,32 +791,174 @@
 isontalTest() %7B%0A
+//%09%09dimensionToTest = mock(Dimension.class);%0A//%09%09when(dimensionToTest.height).thenReturn(40);%0A//%09%09when(dimensionToTest.width).thenReturn(20);%0A
 %09%09dimensionToTes

update in test of ImageResize