{"action":"created","issue":{"url":"https://api.github.com/repos/jmockit/jmockit1/issues/222","labels_url":"https://api.github.com/repos/jmockit/jmockit1/issues/222/labels{/name}","comments_url":"https://api.github.com/repos/jmockit/jmockit1/issues/222/comments","events_url":"https://api.github.com/repos/jmockit/jmockit1/issues/222/events","html_url":"https://github.com/jmockit/jmockit1/issues/222","id":113045475,"number":222,"title":"Injection fails with two constructors present (one @Autowired)","user":{"login":"benze","id":2797306,"avatar_url":"https://avatars.githubusercontent.com/u/2797306?v=3","gravatar_id":"","url":"https://api.github.com/users/benze","html_url":"https://github.com/benze","followers_url":"https://api.github.com/users/benze/followers","following_url":"https://api.github.com/users/benze/following{/other_user}","gists_url":"https://api.github.com/users/benze/gists{/gist_id}","starred_url":"https://api.github.com/users/benze/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/benze/subscriptions","organizations_url":"https://api.github.com/users/benze/orgs","repos_url":"https://api.github.com/users/benze/repos","events_url":"https://api.github.com/users/benze/events{/privacy}","received_events_url":"https://api.github.com/users/benze/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/jmockit/jmockit1/labels/question","name":"question","color":"cc317c"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-10-23T15:42:23Z","updated_at":"2015-10-23T15:56:32Z","closed_at":null,"body":"I'm not sure if this is a bug, or by design.  I have 2 constructors defined for a class (one autowired and one not).\r\n\r\n```\r\npublic class Counter {\r\n    private Data data = new Data();\r\n    \r\n    @Autowired\r\n    public Counter(Data data){\r\n        this.data = data;\r\n    }\r\n\r\n    public Counter(){}\r\n   \r\n    public void printData(){\r\n        System.out.println(data.toString());\r\n    }\r\n}\r\n```\r\n\r\nHowever, unless I defined a `@Injectable` in my test class, I get the following error:\r\n```\r\njava.lang.IllegalArgumentException: No constructor in tested class that can be satisfied by available injectables\r\n  public test.Counter(test.Data)\r\n    disregarded because no injectable was found for parameter \"data\"\r\n```\r\n\r\nShould JMockit not detect the ability to construct the class using the second empty constructor?  I'm using JMockit 1.19.\r\n\r\nI would have expected the following test class to work:\r\n```\r\n@RunWith(JMockit.class)\r\npublic class CounterTest {\r\n    @Tested(fullyInitialized=true) Counter counter;\r\n\r\n    @Test\r\n    public void testPrint(){\r\n        counter.printData();\r\n    }\r\n}\r\n```\r\n\r\nThanks,\r\n\r\nEric"},"comment":{"url":"https://api.github.com/repos/jmockit/jmockit1/issues/comments/150616572","html_url":"https://github.com/jmockit/jmockit1/issues/222#issuecomment-150616572","issue_url":"https://api.github.com/repos/jmockit/jmockit1/issues/222","id":150616572,"user":{"login":"benze","id":2797306,"avatar_url":"https://avatars.githubusercontent.com/u/2797306?v=3","gravatar_id":"","url":"https://api.github.com/users/benze","html_url":"https://github.com/benze","followers_url":"https://api.github.com/users/benze/followers","following_url":"https://api.github.com/users/benze/following{/other_user}","gists_url":"https://api.github.com/users/benze/gists{/gist_id}","starred_url":"https://api.github.com/users/benze/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/benze/subscriptions","organizations_url":"https://api.github.com/users/benze/orgs","repos_url":"https://api.github.com/users/benze/repos","events_url":"https://api.github.com/users/benze/events{/privacy}","received_events_url":"https://api.github.com/users/benze/received_events","type":"User","site_admin":false},"created_at":"2015-10-23T15:56:32Z","updated_at":"2015-10-23T15:56:32Z","body":"I know/realize that constructor injection is not supported. But there is a second constructor available.  Why is the second constructor not used in that case?"}}