Skip to content

Commit 12a18c3

Browse files
committed
Polish Serialization Tests
If Instancio fails to instatiate the class sample, it will now also delete the serialized sample file. Otherwise, it will leave a zero-byte file on the filesystem, confusing future test runs
1 parent d04f707 commit 12a18c3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

config/src/test/java/org/springframework/security/SpringSecurityCoreVersionSerializableTests.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -775,10 +775,10 @@ void serializeCurrentVersionClasses(Class<?> clazz) throws Exception {
775775
return;
776776
}
777777
Files.createFile(filePath);
778-
Object instance = instancioWithDefaults(clazz).create();
779-
assertThat(instance).isInstanceOf(clazz);
780778
try (FileOutputStream fileOutputStream = new FileOutputStream(file);
781779
ObjectOutputStream objectOutputStream = new ObjectOutputStream(fileOutputStream)) {
780+
Object instance = instancioWithDefaults(clazz).create();
781+
assertThat(instance).isInstanceOf(clazz);
782782
objectOutputStream.writeObject(instance);
783783
objectOutputStream.flush();
784784
}

0 commit comments

Comments
 (0)