def test_Compile_WrapMethodInClass_hello_world(): """Test output of wrapping a method in a class.""" assert java.Compile( java.WrapMethodInClass("""\ private static void Hello() { System.out.println("Hello, world!"); }""")) == """\
def test_Compile_WrapMethodInClass_undefined_symbol(): """Test that error is raised if method has undefined symbols.""" with pytest.raises(errors.BadCodeException): java.Compile(java.WrapMethodInClass(""" private static void Hello() { UndefinedMethod(5); } """))
def test_Compile_InsertShimImports_WrapMethodInClass_array_list(): """Test output of wrapping a method in a class.""" assert """\ private static void Hello() { ArrayList<Object> a = new ArrayList<>(); System.out.println("Hello, world!"); } """ in java.Compile(java.InsertShimImports(java.WrapMethodInClass("""\ private static void Hello() { ArrayList<Object> a = new ArrayList<>(); System.out.println("Hello, world!"); } """)))
def test_Compile_WrapMethodInClass_syntax_error(): """Test that error is raised if method contains a syntax error.""" with pytest.raises(errors.BadCodeException): java.Compile(java.WrapMethodInClass("!@///"))