I was wondering if it possible to save instance of an object during runtime and use that instance latter on for testing.
My case is that my application makes request to server, parses json response to objects and latter on I want to use some of these instances for junit testing.
I don't want to serialize them.
For example I have Set containing strings "1","2","3". At given point i want to save an instance of it. Program goes, expects all the fields of the object, makes new instance, initialize it with current values and stores it as MySet or something like this and it contains the given strings.
I hope I was clear enough. "I don't want to serialize them" -- do you just mean you don't want to implement Serializable? Because persisting object states for later use is pretty much the definition of serialization.
以上就是Save instance of object during runtime and use it later for testing java的详细内容，更多请关注web前端其它相关文章！