docs: update mute idiom

This commit is contained in:
Ilkka Seppälä
2024-05-09 14:03:39 +03:00
parent 6cc4525bc1
commit 10cb8c0c09
3 changed files with 86 additions and 58 deletions
@@ -26,10 +26,12 @@ package com.iluwatar.mute;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import lombok.extern.slf4j.Slf4j;
/**
* A utility class that allows you to utilize mute idiom.
*/
@Slf4j
public final class Mute {
// The constructor is never meant to be called.
@@ -40,7 +42,7 @@ public final class Mute {
* Executes the <code>runnable</code> and throws the exception occurred within a {@link
* AssertionError}. This method should be utilized to mute the operations that are guaranteed not
* to throw an exception. For instance {@link ByteArrayOutputStream#write(byte[])} declares in
* it's signature that it can throw an {@link IOException}, but in reality it cannot. This is
* its signature that it can throw an {@link IOException}, but in reality it cannot. This is
* because the bulk write method is not overridden in {@link ByteArrayOutputStream}.
*
* @param runnable a runnable that should never throw an exception on execution.