{"action":"closed","issue":{"url":"https://api.github.com/repos/travis-ci/travis-ci/issues/3852","labels_url":"https://api.github.com/repos/travis-ci/travis-ci/issues/3852/labels{/name}","comments_url":"https://api.github.com/repos/travis-ci/travis-ci/issues/3852/comments","events_url":"https://api.github.com/repos/travis-ci/travis-ci/issues/3852/events","html_url":"https://github.com/travis-ci/travis-ci/issues/3852","id":73259736,"number":3852,"title":"Unit Testing fails in OracleJDK 8","user":{"login":"zjhzxhz","id":1730504,"avatar_url":"https://avatars.githubusercontent.com/u/1730504?v=3","gravatar_id":"","url":"https://api.github.com/users/zjhzxhz","html_url":"https://github.com/zjhzxhz","followers_url":"https://api.github.com/users/zjhzxhz/followers","following_url":"https://api.github.com/users/zjhzxhz/following{/other_user}","gists_url":"https://api.github.com/users/zjhzxhz/gists{/gist_id}","starred_url":"https://api.github.com/users/zjhzxhz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zjhzxhz/subscriptions","organizations_url":"https://api.github.com/users/zjhzxhz/orgs","repos_url":"https://api.github.com/users/zjhzxhz/repos","events_url":"https://api.github.com/users/zjhzxhz/events{/privacy}","received_events_url":"https://api.github.com/users/zjhzxhz/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/travis-ci/travis-ci/labels/awaiting-followup","name":"awaiting-followup","color":"eb6420"},{"url":"https://api.github.com/repos/travis-ci/travis-ci/labels/java","name":"java","color":"006b75"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-05-05T09:27:45Z","updated_at":"2016-01-20T14:17:24Z","closed_at":"2016-01-20T14:17:24Z","body":"It's strange that I can pass all unit testing cases in OracleJDK 7 and OpenJDK 7.\r\nBut fails in OracleJDK 8.\r\nI can pass all unit testing cases in my development environment with OracleJDK 8.\r\n\r\nThis is the unit testing code that fails:\r\n```\r\n@Test\r\npublic void testGetLanguageUsingIdExists() {\r\n\tLanguage language = languageMapper.getLanguageUsingId(1);\r\n\tAssert.assertNotNull(language);\r\n\t\r\n\tString languageName = language.getLanguageName();\r\n\tAssert.assertEquals(\"C\", languageName);\r\n}\r\n```\r\n\r\nThis is the code of `LanguageMapper` class:\r\n```\r\n@Select(\"SELECT * FROM voj_languages WHERE language_id = #{languageId}\")\r\n@Options(useCache = true)\r\n@Results({\r\n\t @Result(property = \"languageId\", column = \"language_id\"),\r\n\t @Result(property = \"languageSlug\", column = \"language_slug\"),\r\n\t @Result(property = \"languageName\", column = \"language_name\")\r\n})\r\npublic Language getLanguageUsingId(@Param(\"languageId\") int languageId);\r\n```\r\n\r\nThis is the data in MySQL:\r\n```\r\nCREATE TABLE IF NOT EXISTS `voj_languages` (\r\n`language_id` int(4) NOT NULL,\r\n  `language_slug` varchar(16) NOT NULL,\r\n  `language_name` varchar(16) NOT NULL\r\n) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8;\r\n\r\nINSERT INTO `voj_languages` (`language_id`, `language_slug`, `language_name`) VALUES\r\n(1, 'text/x-csrc', 'C'),\r\n(2, 'text/x-c++src', 'C++'),\r\n(3, 'text/x-java', 'Java'),\r\n(4, 'text/x-pascal', 'Pascal'),\r\n(5, 'text/x-python', 'Python'),\r\n(6, 'text/x-ruby', 'Ruby');\r\n```\r\n\r\nThis is the configuration of TravisCI:\r\n```\r\nlanguage: java\r\njdk:\r\n  - oraclejdk8\r\n  - oraclejdk7\r\n  - openjdk7\r\n\r\nservices: mysql\r\n\r\nbefore_script:\r\n  - mysql -e 'CREATE DATABASE test;'\r\n  - mysql test < voj.sql\r\n\r\nscript: mvn test -f web/pom.xml\r\n\r\nafter_script:\r\n  - mysql -e 'DROP DATABASE test;'\r\n```\r\n\r\nThis is the log of TravisCI with OracleJDK 8: [Job#36.1](https://travis-ci.org/zjhzxhz/voj/jobs/61275016)\r\n```\r\nFailed tests:   testGetLanguageUsingIdExists(com.trunkshell.voj.mapper.LanguageMapperTest): expected:<C[]> but was:<C[ Language]>\r\n```\r\n\r\nThere's no `C Language` in the `testGetLanguageUsingIdExists()` method. **However**, the `C Language` appears in another method of unit testing classes:\r\n```\r\n@Test\r\npublic void testUpdateLanguageNormal() {\r\n\tLanguage language = languageMapper.getLanguageUsingId(1);\r\n\tAssert.assertNotNull(language);\r\n\t\r\n\tlanguage.setLanguageName(\"C Language\");\r\n\tlanguageMapper.updateLanguage(language);\r\n\t\r\n\tlanguage = languageMapper.getLanguageUsingId(1);\r\n\tAssert.assertEquals(\"C Language\", language.getLanguageName());\r\n}\r\n```\r\n\r\nBut I have set `defaultRollback = true` for the unit testing classes:\r\n```\r\n@RunWith(SpringJUnit4ClassRunner.class)\r\n@Transactional\r\n@TransactionConfiguration(defaultRollback = true)\r\n@ContextConfiguration({\"classpath:test-spring-context.xml\"})\r\npublic class LanguageMapperTest { ... }\r\n```\r\n\r\n**Most importantly**, the unit testing cases fails **ONLY** in OracleJDK 8.\r\nI guess there must be something wrong with your system.\r\nPlease fix it ASAP."}}