Skip to content

Commit

Permalink
Don't use KryoReflectionFactorySupport in SubListSerializersTest
Browse files Browse the repository at this point in the history
But use std kryo approach, KryoReflectionFactorySupport not needed.
  • Loading branch information
Martin Grotzke committed Jan 27, 2019
1 parent 7fbd8da commit 6e41e26
Showing 1 changed file with 7 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
import java.util.LinkedList;
import java.util.List;

import com.esotericsoftware.kryo.util.DefaultInstantiatorStrategy;
import org.objenesis.strategy.StdInstantiatorStrategy;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;

Expand All @@ -42,20 +44,12 @@ public class SubListSerializersTest {

@BeforeClass
public void beforeClass() {
_kryo = new KryoReflectionFactorySupport() {

@Override
@SuppressWarnings("rawtypes")
public Serializer<?> getDefaultSerializer(final Class type) {
final Serializer<List<?>> subListSerializer = SubListSerializers.createFor(type);
if ( subListSerializer != null ) {
return subListSerializer;
}
return super.getDefaultSerializer(type);
}

};
_kryo = new Kryo();
_kryo.setRegistrationRequired(false);
SubListSerializers.addDefaultSerializers(_kryo);
final DefaultInstantiatorStrategy instantiatorStrategy = new DefaultInstantiatorStrategy();
instantiatorStrategy.setFallbackInstantiatorStrategy(new StdInstantiatorStrategy());
_kryo.setInstantiatorStrategy(instantiatorStrategy);
}

private void doTest(final List<TestEnum> subList) {
Expand Down

0 comments on commit 6e41e26

Please sign in to comment.