package generics.graphics;

import static org.junit.Assert.*;

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;

import othello.gui.graphics.ImageResize;

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 = mock(Dimension.class);
//		when(dimensionToTest.height).thenReturn(40);
//		when(dimensionToTest.width).thenReturn(20);
		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());
	}
}

@@ -637,16 +637,24 @@
 Stream(%22
+othello/
 gui/grap
@@ -671,16 +671,16 @@
 .jpg%22);%0A
-
 %09%09%09testI
@@ -746,32 +746,32 @@
 %0A%09%09%7D%0A%09%7D%0A%0A%09@Test%0A
+
 %09public void Hor
@@ -790,150 +790,8 @@
 ) %7B%0A
-//%09%09dimensionToTest = mock(Dimension.class);%0A//%09%09when(dimensionToTest.height).thenReturn(40);%0A//%09%09when(dimensionToTest.width).thenReturn(20);%0A
 %09%09di

test was broken