package floor;

import static org.junit.Assert.*;

import java.lang.reflect.Method;

import org.junit.Before;
import org.junit.Test;

public class FloorTest {

	private Floor floor;
	private final int floorNumber = 2;

	@Before
	public void setUp() throws Exception {
		floor = new Floor(floorNumber);
	}

	@Test
	public void testAddToRequestedFloors() throws Exception {
		Method addToRequestedFloors = Floor.class.getDeclaredMethod("addToRequestedFloors", int.class);
		addToRequestedFloors.setAccessible(true);

		int floorDown = floorNumber - 1;
		addToRequestedFloors.invoke(floor, floorDown);
		assertTrue(floor.getRequestedFloorsDown().contains(floorDown));

		int floorUp = floorNumber + 1;
		addToRequestedFloors.invoke(floor, floorUp);
		assertTrue(floor.getRequestedFloorsUp().contains(floorUp));
	}

}
