• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 package com.fasterxml.jackson.databind.deser;
2 
3 import com.fasterxml.jackson.annotation.*;
4 
5 import com.fasterxml.jackson.databind.*;
6 
7 /**
8  * Tests for checking that static methods are not recognized as accessors
9  * for properties
10  */
11 public class TestStatics
12     extends BaseMapTest
13 {
14     static class Bean
15     {
16         int _x;
17 
setX(int value)18         public static void setX(int value) { throw new Error("Should NOT call static method"); }
19 
assignX(int x)20         @JsonProperty("x") public void assignX(int x) { _x = x; }
21     }
22 
23     /*
24     /**********************************************************
25     /* Test methods
26     /**********************************************************
27      */
28 
testSimpleIgnore()29     public void testSimpleIgnore() throws Exception
30     {
31         ObjectMapper m = new ObjectMapper();
32         // should not care about static setter...
33         Bean result = m.readValue("{ \"x\":3}", Bean.class);
34         assertEquals(3, result._x);
35     }
36 }
37