Title: Test Smell: the wrong parameter order in ''assertEquals'' assertion · Issue #1923 · docker-java/docker-java · GitHub
Open Graph Title: Test Smell: the wrong parameter order in ''assertEquals'' assertion · Issue #1923 · docker-java/docker-java
X Title: Test Smell: the wrong parameter order in ''assertEquals'' assertion · Issue #1923 · docker-java/docker-java
Description: Hi! Description: we detect that some assertions in your test code have the wrong parameter orders. For example, the test case named ''copyFromContainerBinaryFile()'' in ''CopyArchiveFromContainerCmdIT.java'' writes the ''assertEquals'' a...
Open Graph Description: Hi! Description: we detect that some assertions in your test code have the wrong parameter orders. For example, the test case named ''copyFromContainerBinaryFile()'' in ''CopyArchiveFromContainerCm...
X Description: Hi! Description: we detect that some assertions in your test code have the wrong parameter orders. For example, the test case named ''copyFromContainerBinaryFile()'' in ''Co...
Opengraph URL: https://github.com/docker-java/docker-java/issues/1923
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Test Smell: the wrong parameter order in ''assertEquals'' assertion","articleBody":"Hi!\r\n\r\nDescription:\r\nwe detect that some assertions in your test code have the wrong parameter orders.\r\nFor example, the test case named ''copyFromContainerBinaryFile()'' in ''CopyArchiveFromContainerCmdIT.java'' writes the ''assertEquals'' assertion as\r\n\r\nHowever, referring to the API documentation of ''org.junit.Assert’’ is ''assertEquals(Object expected, Object actual)''.\r\n\r\nNegative:\r\nUsing ''assertEquals()'' with the wrong parameter order is a bad test practice.\r\nBecause once the test case fails, the ''assertEquals()'' assertion with the wrong parameter order will give the wrong log information.\r\nThe log information will say:’’ java.lang.AssertionError: expected [actual value] but found [ excepted value]’’, where it should have said \"java.lang.AssertionError: expected [excepted value] but found [actual value]''.\r\nThis is confusing, to say the least, and you shouldn't have to deal with a possible misdirection of that message.\r\n\r\nsolution:\r\nGenerally, the excepted value should be a known value, such as a real number, a string, etc.\r\nThe actual value should be the result of the method-under-test.\r\nThe best way to eliminate the test smell is to exchange the parameter in ''assertEquals'' assertions.\r\n\r\nWe list other test cases with the same problem as follows:\r\n1. copyFromContainerBinaryFile() in CopyArchiveFromContainerCmdIT.java\r\n2. version() in VersionCmdIT.java\r\n3. configuredInstanceAuthConfig() in DockerClientImplTest.java\r\n4. defaults() in DefaultDockerClientConfigTest.java\r\n5. assertTarArchiveEntryIsExecutableFile() in CompressArchiveUtilTest.java\r\n6. serializeCapability() in CapabilityTest.java ...","author":{"url":"https://github.com/TestSmell","@type":"Person","name":"TestSmell"},"datePublished":"2022-08-15T09:19:15.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":3},"url":"https://github.com/1923/docker-java/issues/1923"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:0172181c-7115-a51c-05da-ac952acbfe47 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9A32:B6C89:3BB05CE:523D65F:6A4F4829 |
| html-safe-nonce | 5439b323bf27d87b9334852b1bd2771590fb53c0da741524aae62391dc3d44e4 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5QTMyOkI2Qzg5OjNCQjA1Q0U6NTIzRDY1Rjo2QTRGNDgyOSIsInZpc2l0b3JfaWQiOiIxMzM2MzIwMzA3ODk2NDY5NTQ1IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 050a6bd2077012d994b6cbcb42b5661a256e51cb3424c53fdc9b3eede62a0020 |
| hovercard-subject-tag | issue:1338742787 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/docker-java/docker-java/1923/issue_layout |
| twitter:image | https://opengraph.githubassets.com/b6229cf2dfb1de1aab40c68ae377f491e7d1d14d54def22c8152754016665902/docker-java/docker-java/issues/1923 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/b6229cf2dfb1de1aab40c68ae377f491e7d1d14d54def22c8152754016665902/docker-java/docker-java/issues/1923 |
| og:image:alt | Hi! Description: we detect that some assertions in your test code have the wrong parameter orders. For example, the test case named ''copyFromContainerBinaryFile()'' in ''CopyArchiveFromContainerCm... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | TestSmell |
| hostname | github.com |
| expected-hostname | github.com |
| None | b92d11c0aa4a77d54ef4af1078b6a15fb5a70a215b30c4ecf28889d5a8e656d9 |
| turbo-cache-control | no-preview |
| go-import | github.com/docker-java/docker-java git https://github.com/docker-java/docker-java.git |
| octolytics-dimension-user_id | 7772003 |
| octolytics-dimension-user_login | docker-java |
| octolytics-dimension-repository_id | 20415251 |
| octolytics-dimension-repository_nwo | docker-java/docker-java |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 20415251 |
| octolytics-dimension-repository_network_root_nwo | docker-java/docker-java |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 4b249b445842943ed31549e027f57a8ade9881ed |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width