### Question:
UserSerialization extends FileRepositorySerializer<User> { @Override protected String serialize( User user ) { return String.join( userSeparator, user.name(), serialize( (LegacyCredential) user.credentials() ), String.join( ",", user.getFlags() ) ); }    }### Answer:
@Test public void shouldSerializeAndDeserialize() throws Exception { UserSerialization serialization = new UserSerialization(); List<User> users = asList( new User.Builder( "Mike", LegacyCredential.forPassword( "1234321" ) ).withFlag( "not_as_nice" ).build(), new User.Builder( "Steve", LegacyCredential.forPassword( "1234321" ) ).build(), new User.Builder( "steve.stevesson@WINDOMAIN", LegacyCredential.forPassword( "1234321" ) ).build(), new User.Builder( "Bob", LegacyCredential.forPassword( "0987654" ) ).build() ); byte[] serialized = serialization.serialize( users ); assertThat( serialization.deserializeRecords( serialized ), equalTo( users ) ); }