package ru.job4j.start;

import ru.job4j.models.*;

/**.
* chapter_002
* It's class for testing behavior users
* 
* @author Anton Vasilyuk
* @version 1.0
* @since 0.1
*/

public class StubInput implements Input {

	/**.
	* @tracker tracker is object for inspection
	*/
	private Tracker tracker = new Tracker();

	/**.
	* @answers answers is array for parametr testing
	*/
	private String[] answers;

	/**.
	* @position index for array
	*/
	private int position = 0;

	/**.
	* Constructor
	* @param answers array for data 
	*/
	public StubInput(String[] answers) {
		this.answers = answers;
	}

	/**.
	* method for write answer in the array answers
	* @param question
	* @return answer
	*/
	public String ask(String question) {
		return answers[position++];
	}

	/**.
	* method for output
	* @param question
	* @param ranges
	* @return -1
	*/
	public int ask(String question, int[] ranges) {
		return -1;
	}
}
@@ -211,106 +211,8 @@
  %7B%0A%0A
-%09/**.%0A%09* @tracker tracker is object for inspection%0A%09*/%0A%09private Tracker tracker = new Tracker();%0A%0A
 %09/**
@@ -792,18 +792,266 @@
 %7B%0A%09%09
-return -1;
+int key = Integer.valueOf(this.ask(question));%0A%09%09boolean check = false;%0A%09%09for (int value : ranges) %7B%0A%09%09%09if (value == key) %7B%0A%09%09%09%09check = true;%0A%09%09%09%09break;%0A%09%09%09%7D%0A%09%09%7D%0A%09%09if (check) %7B%0A%09%09%09return key;%0A%09%09%7D else %7B%0A%09%09%09throw new MenuOutException(%22Out of menu range%22);%0A%09%09%7D
 %0A%09%7D%0A

add file for chapter_002_2.7.1