assertEquals(strategy.translateName(SimpleTest.class.getDeclaredField("c")), "cat");
assertEquals(strategy.translateName(SimpleTest.class.getDeclaredField("d")), "dog");
}
public void testAnnotationConstructorFieldNamingStrategyCPAndNamed() throws Exception {
AnnotationConstructorNamingStrategy strategy = new AnnotationConstructorNamingStrategy(
ImmutableSet.of(ConstructorProperties.class), ImmutableSet.of(new ExtractNamed()));
Invokable<SimpleTest, SimpleTest> constructor = strategy.getDeserializer(typeToken(SimpleTest.class));
assertNotNull(constructor);
assertEquals(constructor.getParameters().size(), 4);
assertEquals(strategy.translateName(constructor, 0), "aardvark");
assertEquals(strategy.translateName(constructor, 1), "bat");
assertEquals(strategy.translateName(constructor, 2), "coyote");
// Note: @Named overrides the ConstructorProperties setting
assertEquals(strategy.translateName(constructor, 3), "dingo");
Invokable<MixedConstructorTest, MixedConstructorTest> mixedCtor = strategy.getDeserializer(typeToken(MixedConstructorTest.class));
assertNotNull(mixedCtor);
assertEquals(mixedCtor.getParameters().size(), 4);
assertEquals(strategy.translateName(mixedCtor, 0), "aardvark");
assertEquals(strategy.translateName(mixedCtor, 1), "bat");
assertEquals(strategy.translateName(mixedCtor, 2), "cat");
assertEquals(strategy.translateName(mixedCtor, 3), "dog");
}