You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Simple yet kludgy way to get around "Tests should include assertions" false positives reported by Sonar, perhaps due to AssertJ.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
When working with mutable objects, I often instantiate some object and subsequently call mutator methods to populate its state. I find this both boring and smelly.
Consider the following (admittedly contrived) unit test:
Overall, Java's compiler is an impressive piece of software (not nearly as impressive as the JVM, though) that has no doubt saved me from countless hours hunting down runtime issues. Nevertheless, there are times when the compiler makes me sad.
Texas Hold'em except that one extra card dealt to each player on the deal and per flop. Players must discard a card from their hand each round so that they have only two cards before betting.
Rules
Deal three cards face down to each player. Each player discards a card from their hand and there's a round of betting.
Deal three community cards face up in the middle of the table and one card dealt face down to each player. Each player discards a card from their hand and there's another round of betting.
Inheritance might be the most unjustly maligned language feature. The amount of effort that has been expended at the language level to tame it over the decades has been extraordinary.
Java dropped multiple inheritance and offered interfaces to cut away some hazard. Scala introduced traits; Ruby introduced modules.
But you can use inheritance safely if you just follow a few guidelines.
Only inherit to complete an abstraction. Abtract classes have empty spaces that you fill. Don't override anything concrete.
After suffering java.util.Date and Calendar for many years, Java 8's new Date/Time API was a welcome and groovy addition to Java SE in and of itself. Groovy's upcoming 2.5 and 3.0 release, however, makes it even groovier.
To follow along with the examples, you will need to download either Groovy 2.5-rc1 or Groovy 3.0-alpha-2 (or later releases in those 2.5 or 3.0 lines). Date/Time API-related features are not in Groovy 2.6 as that version is intended to be a Groovy 3.0 backport for Java 7, which predates the Date/Time API.
Creating Date/Time Instances
Groovy's great operability with Java means that the on and now factory methods for the various types within the java.time package can be used to create instances, but there are now some Groovy-specific alternatives.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Replicating Java 9's Map.of or Guava's ImmutableMap.of in pure Java 8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Our organization is in the midst of a push to improve the state of unit testing. I had thought I communicated the need for unit testing well and explained its importance sufficiently, but I attended a meeting recently that made me realize I still had much work to do.
Organizational Background
The IT organization is largely driven and managed by non-developers. Our processes regard developers as "resources" who are procured, managed using rigid enterprise-wide processes, and expected to produce features. As such, code is not well-understood beyond the tacit acknowledgement that code needs to be written in order to build a feature. The fact that code accrues, that a unit test written during a user story has benefit for the development of future stories, and that overall code quality has a signficant impact on a team's ability to enhance a system safely and productively is largely lost in the sea of contracting and project management best practices. Sure, there's