Skip to content

Parameter not checked correctly when AliasFor is used in annotation #2

@fjakop

Description

@fjakop

Given an annotated method like

import org.springframework.web.bind.annotation.*;

public class MyClass {
  @GetMapping(produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
  public ResponseEntity<Map<String, Result>> myMethod() { ... } 
}

the following validation fails

@Test
public void annotations() throws Exception {
    AnnotationValidator.validate().exactly()
            .annotation(type(GetMapping.class)
                .param("produces", MediaType.APPLICATION_JSON_UTF8_VALUE))
            .forMethod(MyClass.class.getDeclaredMethod("myMethod"));
} 

the functional equal annotated method is validated (when adding the method param)

@RequestMapping(method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public ResponseEntity<Map<String, Result>> myMethod() { ... } 

We are using version 1.2.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions