CodeSOD: Cover Up
Goodhart's Law states that when a measure becomes a target, it ceases to be a good measure. Or, more to the point: you get what you measure.
If, for example, you measure code coverage, you are going to get code coverage. It doesn't mean the tests will be any good, it just means that you'll write tests that exercise different blocks of code.
For example, Capybara James sends us this unit test:
@MockitoSettings class CentralizedLoggerTest { @InjectMocks private CentralizedLogger centralizedLogger; @Test void logAround() throws Throwable { centralizedLogger = new CentralizedLogger(); MethodSignature signature = mock(MethodSignature.class); ProceedingJoinPoint joinPoint = mock(ProceedingJoinPoint.class); when(joinPoint.getSignature()).thenReturn(signature); centralizedLogger.logAround(joinPoint); Assertions.assertTrue(true); } }It doesn't really matter what the mocks are, or what gets instantiated, or honestly, anything that's happening here. The assertion is the beginning and ending.
James writes:
The only requirement was sonar coverage to push the code to production. There is no other purpose.
Kim Kardashian reveals hidden talent daughter Chicago, 8, inherited from Kanye West... after North's debut rap song
Chicago is one of four children Kim Kardashian shares with her ex-husband Kanye West, who she divorced in 2021 after six years of marriage.
Is this why your sex life declines after having kids? Wife of comedian Rob Beckett explains the feeling of being 'touched out' and why more men need to 'suck it up'
Lou Beckett has revealed why exhausted mothers are often too 'touched out' to want sex with their partners, telling men they need to stop expecting intimacy.
Emma says she was simply trying to boost morale at work. But colleagues claim her Satanic 'summoning ritual' left them traumatised
A hotel worker who was sacked for arranging rubber ducks around a pentagram for a mock 'summoning ritual' has won the ultimate revenge on her colleagues.
Read the Alexander Brothers' despicable texts they thought would never see the light of day: Inside sex crimes trial so vile people are crying in court
The second week of the Alexander brothers' sex trafficking trial ended with prosecutors placing the siblings' own words at the center of their case - sharing a trove of disturbing texts.
Truth about NASA's 'missing' moon tapes revealed after 57 years
An expert on all things NASA has revealed the shocking fate of what happened to the original tapes containing the Apollo 11 moon landing in 1969.
Swarm of interstellar objects detected passing within Earth's orbit around the sun
A Harvard scientist has suggested that our Solar System may be far more crowded with interstellar objects than anyone realized.
Angelina Jolie is effortlessly chic in Paris after making rare comments on her double mastectomy scars
Earlier on Tuesday, Jolie discussed her mastectomy scars - which she recently showed for the first time in December - after having a preventive double mastectomy over a decade ago.
Hidden clues in Nancy Guthrie suspect video: The getaway car, what the flowers reveal and a shocking new abduction theory
Senior law enforcement sources told the Daily Mail there are distinctive signs in the suspect's clothing, movements and mannerisms that could provide the breakthrough investigators need.
TV property guru who once boasted of £30million empire is banned from contacting his ex-wife as court hears he is now penniless and living with a friend
Glenn Armstrong, 66, once appeared on 'How The Other Half Live' boasting of his wealth, but is now penniless and banned from contacting his ex-wife.
'I felt nothing': Bondi hero gives heartbreaking health update as he prepares to return to work despite his new multi-millionaire status
Ahmed al Ahmed was shot multiple times during the December 14 attack at Bondi Beach, shortly after he heroically disarmed gunman Sajid Akram.
MasterChef: The Professionals fans praise new judge Matt Tebbutt as 'a breath of fresh air' and 'great addition to the kitchen' after replacing axed host Gregg Wallace
The Saturday Kitchen star, 52, appeared on the first episode of the culinary contest's 18th season alongside fellow chefs and judges. Marcus Wareing and Monica Galetti.
Tutors are charging £250 an hour 'to help children with anxiety'
More families are looking for tutors who can support their children with emotional regulation and for those with special educational needs and disabilities (SEND).
Europe's best and worst cities for sleep revealed - and London is one of the lowest in the ranking
The European Sleep Index assessed 25 cities across the continent to rank the best and worst for sleep, analysing factors such as air quality, noise levels, smoking rates and late-night alcohol consumption.
Inside one of the world's most infamous prisons turned into five-star boutique hotel with an underground swimming pool
Fancy a stay in a former prison? If you're not convinced, the list of luxuries available at this Australian hotel might well tempt you further - and lure you in.
The Pussycat Dolls reunite! Ashley Roberts, Nicole Scherzinger and Kimberly Wyatt enjoy girls' night out in Mayfair amid rumours they are set to make a comeback as a trio
Ashley Roberts, Nicole Scherzinger and Kimberly Wyatt dressed to impress as they enjoyed a girls' night out at Gaia in London's Mayfair on Tuesday evening, amid rumours of a comeback.
Starmer is 'too weak' to fire Wes Streeting over Mandelson message row after release of private texts signed with a kiss
The Health Secretary broke ranks on Monday night by releasing his private messages to Peter Mandelson in a bid to distance himself from the disgraced peer.
The Princess of Wales signalled a key jewellery trend with her gold heart necklace - here are our favourite pendants to buy
The Princess of Wales is known for her fabulous jewellery choices, whether it's a glittering tiara for a state banquet or a simple pair of gold hoops from an independent British brand.
British Airways crew 'rushed to hospital after being given weed-laced gummies by passenger'
The British Airways crew members are said to have had 'out-of-body experiences' after unknowingly consuming the weed-laced gummies.
Family's fury over teenage killer's 13-year prison sentence: Leo Ross's mother says jail term of teenage thug who stabbed son, 12, is a 'joke' and why 'kids are killing kids'
Leo Ross was walking home from school by himself through a park in the Hall Green area of Birmingham when he was ambushed by the teenager