1 package com.fasterxml.jackson.databind; 2 3 import com.fasterxml.jackson.core.Version; 4 import com.fasterxml.jackson.core.Versioned; 5 6 import com.fasterxml.jackson.databind.ObjectMapper; 7 import com.fasterxml.jackson.databind.introspect.JacksonAnnotationIntrospector; 8 import com.fasterxml.jackson.databind.cfg.PackageVersion; 9 10 /** 11 * Tests to ensure that we get proper Version information via 12 * things defined as Versioned. 13 */ 14 public class TestVersions extends BaseMapTest 15 { testMapperVersions()16 public void testMapperVersions() 17 { 18 ObjectMapper mapper = new ObjectMapper(); 19 assertVersion(mapper); 20 assertVersion(mapper.reader()); 21 assertVersion(mapper.writer()); 22 assertVersion(new JacksonAnnotationIntrospector()); 23 } 24 25 /* 26 /********************************************************** 27 /* Helper methods 28 /********************************************************** 29 */ 30 assertVersion(Versioned vers)31 private void assertVersion(Versioned vers) 32 { 33 Version v = vers.version(); 34 assertFalse("Should find version information (got "+v+")", v.isUnknownVersion()); 35 Version exp = PackageVersion.VERSION; 36 assertEquals(exp.toFullString(), v.toFullString()); 37 assertEquals(exp, v); 38 } 39 } 40