Have to agree that I am having problems to understand what the thing does. But 
that might be related to me not having had my first coffee if the day yet ;-)


Outlook for Android<https://aka.ms/ghei36> herunterladen

From: Justin Mclean <jus...@classsoftware.com>
Sent: Tuesday, February 20, 2018 1:12:23 AM
To: dev@plc4x.apache.org
Subject: WET vs DRY tests


Was just looking at some of the new tests and just wondering if they are trying 
to be a bit too clever? What do other people think?

For instance this:

public void testOfWintime() throws Exception {
    assumeThat(clazz, isOneOf(TimeStamp.class));
        Method ofMethod = clazz.getDeclaredMethod("ofWinTime", 
        ofMethod.invoke(null, BigInteger.valueOf(1));
        Method ofMethod = clazz.getDeclaredMethod("ofWinTime", String.class);
        ofMethod.invoke(null, "1");
        Method ofMethod = clazz.getDeclaredMethod("ofWinTime", long.class);
        ofMethod.invoke(null, 1L);

Could be replaced with 3 asserThat calls calling TimeStamp.ofWinTime and as a 
bonus actually test that the class is correctly initialised :-)

IMO tests are part of the documentation and should be easy to read and you 
shouldn’t have to think that hard about them and as a bonus if they are easy to 
read people are more likely to contribute to them.


Reply via email to