CustomEditor and void Serialization

Hello!

There is a class, and the extension of the inspector:

using UnityEngine;
using System.Collections;

public class myClass : MonoBehaviour
{
    public int test1 = 1;
    public int test2 = 1;


    public void testVoid()
    {
        test2 = 5;
    }
}
using UnityEngine;
using System.Collections;
using UnityEditor;

[CustomEditor(typeof(myClass))]
public class myClass_Editor : Editor
{
    myClass obj = null;

    SerializedProperty test1Property;


    public void OnEnable()
    {
        obj = (myClass)target;

        test1Property = serializedObject.FindProperty("test1");
    }

    public override void OnInspectorGUI()
    {
        serializedObject.Update();


        if (GUILayout.Button("Set"))
        {
            test1Property.intValue = 5;
            obj.testVoid();
        }

        serializedObject.ApplyModifiedProperties();
    }
}

After pressing the button “Set”:
test1 == 5
test2 == 1
Why? What to do to test2 also preserved?

test1Property.intValue = 5;
serializedObject.ApplyModifiedProperties();
obj.testVoid();
serializedObject.Update();

You need to update the serializedObject after you make changes outside of the SerializedProperty API

Thank you