### Question:
ParseBoolean { public int parse() { String expression = " if(" + _input + "){" + "returnValue = VALUEA;" + "}" + " else { returnValue = VALUEB; }"; expression = expression.replaceAll("0", " false " ); expression = expression.replaceAll("1", " true " ); expression = expression.replaceAll("\\*", " && " ); expression = expression.replaceAll("\\+", " || " ); expression = expression.replace("VALUEA", " \"1\" " ); expression = expression.replace("VALUEB", " \"0\" " ); System.out.println(expression); ScriptEngineManager manager = new ScriptEngineManager(); ScriptEngine engine = manager.getEngineByName("js"); Object result = null; try { result = engine.eval(expression); } catch (ScriptException e) { } return result == null ? 0 :Integer.parseInt(result.toString()); } ParseBoolean(String input); int parse();  }### Answer:
@Test public void test1() { String input = "(1+0*1)"; ParseBoolean tester = new ParseBoolean(input); int testResults = tester.parse(); assertEquals("Result",1, testResults ); }
@Test public void test2() { String input = "(!0)"; ParseBoolean tester = new ParseBoolean(input); int testResults = tester.parse(); assertEquals("Result",1, testResults ); }
@Test public void test3() { String input = "0"; ParseBoolean tester = new ParseBoolean(input); int testResults = tester.parse(); assertEquals("Result",0, testResults ); }
@Test public void test4() { String input = "0 * 1 * 1"; ParseBoolean tester = new ParseBoolean(input); int testResults = tester.parse(); assertEquals("Result",0, testResults ); }
@Test public void test5() { String input = "(1+0)"; ParseBoolean tester = new ParseBoolean(input); int testResults = tester.parse(); assertEquals("Result",1, testResults ); }
@Test public void test6() { String input = "!0 * 0 + 1"; ParseBoolean tester = new ParseBoolean(input); int testResults = tester.parse(); assertEquals("Result",1, testResults ); }
@Test public void test7() { String input = "(0+1) * (1+0)"; ParseBoolean tester = new ParseBoolean(input); int testResults = tester.parse(); assertEquals("Result",1, testResults ); }
@Test public void test8() { String input = "((0+0+(1+!1+!(0 + !(0*1+0*1*1+1*0)+1)+0*1)+1*0*0)+0*1)"; ParseBoolean tester = new ParseBoolean(input); int testResults = tester.parse(); assertEquals("Result",1, testResults ); }