package com.s24.redjob.queue;

import static org.mockito.Mockito.verify;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Spy;
import org.mockito.runners.MockitoJUnitRunner;

import com.fasterxml.jackson.annotation.JsonTypeName;
import com.fasterxml.jackson.databind.ObjectMapper;

/**
 * Test of {@link PayloadTypeScanner}.
 */
@RunWith(MockitoJUnitRunner.class)
public class PayloadTypeScannerTest {
    /**
     * JSON mapper.
     */
    @Spy
    private ObjectMapper json;

    @Test
    public void afterPropertiesSet() {
        scanForJsonSubtypes(json, TestJob.class);

        verify(json).registerSubtypes(TestJob.class);
    }

    /**
     * Scan packages for JSON subtypes. Useful for tests.
     *
     * @param json JSON mapper to register subtypes (@link {@link JsonTypeName}) at.
     * @param basePackage Class in base package to scan.
     */
    public static void scanForJsonSubtypes(ObjectMapper json, Class<?> basePackage) {
        scanForJsonSubtypes(json, basePackage.getPackage().getName());
    }

    /**
     * Scan packages for JSON subtypes. Useful for tests.
     *
     * @param json JSON mapper to register subtypes (@link {@link JsonTypeName}) at.
     * @param basePackages Base packages to scan.
     */
    public static void scanForJsonSubtypes(ObjectMapper json, String... basePackages) {
        PayloadTypeScanner scanner = new PayloadTypeScanner();
        scanner.setJson(json);
        scanner.setBasePackages(basePackages);
        scanner.afterPropertiesSet();
    }
}

@@ -778,37 +778,54 @@
 ister subtypes (
-@link
+classes annotated with
  %7B@link JsonType
@@ -874,13 +874,8 @@
  in 
-base 
 pack
@@ -877,32 +877,44 @@
  package to scan
+ recursively
 .%0A     */%0A    pu
@@ -1055,18 +1055,8 @@
 ge()
-.getName()
 );%0A 
@@ -1187,21 +1187,426 @@
 btypes (
-@link
+classes annotated with %7B@link JsonTypeName%7D) at.%0A     * @param basePackage Package to scan recursively.%0A     */%0A    public static void scanForJsonSubtypes(ObjectMapper json, Package basePackage) %7B%0A        scanForJsonSubtypes(json, basePackage.getName());%0A    %7D%0A%0A    /**%0A     * Scan packages for JSON subtypes. Useful for tests.%0A     *%0A     * @param json JSON mapper to register subtypes (classes annotated with
  %7B@link 

Rework javadoc