Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

4
  • In a typical Battle the number of guns and stocks of ammo are fixed. Why not pass in the actual information to the Battle class rather than a factory? It seems really odd that you would create a gun for the provided bullet every time. Commented Mar 5, 2020 at 15:03
  • The actual code is rather different, but for obvious reasons I could not share it here. So I made up code to give a basic picture. Imagine that I can only figure out which gun I need to use depending on the Enemy (not bullet). How would you approach the problem? Commented Mar 5, 2020 at 15:14
  • Write code that doesn't require mocks to test. Commented Mar 5, 2020 at 15:22
  • This test is effectively testing the inner implementation of Battle.attack, when it should really relate the expected Damage result from the Bullet and Enemy arguments. Commented Mar 5, 2020 at 15:25