package com.fasterxml.jackson.databind;

import com.fasterxml.jackson.core.Version;
import com.fasterxml.jackson.core.Versioned;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.introspect.JacksonAnnotationIntrospector;

/**
 * Tests to ensure that we get proper Version information via
 * things defined as Versioned.
 */
public class TestVersions extends com.fasterxml.jackson.test.BaseTest
{
    // Not a good to do this, but has to do, for now...
    private final static int MAJOR_VERSION = 2;
    private final static int MINOR_VERSION = 2;

    private final static String GROUP_ID = "com.fasterxml.jackson.core";
    private final static String ARTIFACT_ID = "jackson-databind";

    public void testMapperVersions()
    {
        ObjectMapper mapper = new ObjectMapper();
        assertVersion(mapper);
        assertVersion(mapper.reader());
        assertVersion(mapper.writer());
        assertVersion(new JacksonAnnotationIntrospector());
    }

    /*
    /**********************************************************
    /* Helper methods
    /**********************************************************
     */
    
    private void assertVersion(Versioned vers)
    {
        Version v = vers.version();
        assertFalse("Should find version information (got "+v+")", v.isUknownVersion());
        assertEquals(MAJOR_VERSION, v.getMajorVersion());
        assertEquals(MINOR_VERSION, v.getMinorVersion());
        // Check patch level initially, comment out for maint versions
//        assertEquals(0, v.getPatchLevel());
        assertEquals(GROUP_ID, v.getGroupId());
        assertEquals(ARTIFACT_ID, v.getArtifactId());
    }
}


@@ -254,16 +254,133 @@
 spector;
+%0Aimport com.fasterxml.jackson.databind.cfg.DatabindVersion;%0Aimport com.fasterxml.jackson.databind.cfg.PackageVersion;
 %0A%0A/**%0A *
@@ -551,161 +551,8 @@
 t%0A%7B%0A
-    // Not a good to do this, but has to do, for now...%0A    private final static int MAJOR_VERSION = 2;%0A    private final static int MINOR_VERSION = 2;%0A%0A
     
@@ -958,16 +958,149 @@
 %0A    %7D%0A%0A
+    public void testDatabindVersion()%0A    %7B%0A        assertEquals(PackageVersion.VERSION, DatabindVersion.instance.version());%0A    %7D%0A%0A
     /*%0A 
@@ -1464,319 +1464,33 @@
 als(
-MAJOR_VERSION, v.getMajorVersion());%0A        assertEquals(MINOR_VERSION, v.getMinorVersion());%0A        // Check patch level initially, comment out for maint versions%0A//        assertEquals(0, v.getPatchLevel());%0A        assertEquals(GROUP_ID, v.getGroupId());%0A        assertEquals(ARTIFACT_ID, v.getArtifactId()
+PackageVersion.VERSION, v
 );%0A 

Add a unit test.