diff --git a/abstract-factory/index.md b/abstract-factory/README.md
similarity index 100%
rename from abstract-factory/index.md
rename to abstract-factory/README.md
diff --git a/adapter/index.md b/adapter/README.md
similarity index 100%
rename from adapter/index.md
rename to adapter/README.md
diff --git a/async-method-invocation/index.md b/async-method-invocation/README.md
similarity index 100%
rename from async-method-invocation/index.md
rename to async-method-invocation/README.md
diff --git a/bridge/index.md b/bridge/README.md
similarity index 100%
rename from bridge/index.md
rename to bridge/README.md
diff --git a/builder/index.md b/builder/README.md
similarity index 100%
rename from builder/index.md
rename to builder/README.md
diff --git a/business-delegate/index.md b/business-delegate/README.md
similarity index 100%
rename from business-delegate/index.md
rename to business-delegate/README.md
diff --git a/caching/index.md b/caching/README.md
similarity index 100%
rename from caching/index.md
rename to caching/README.md
diff --git a/callback/index.md b/callback/README.md
similarity index 100%
rename from callback/index.md
rename to callback/README.md
diff --git a/chain/index.md b/chain/README.md
similarity index 100%
rename from chain/index.md
rename to chain/README.md
diff --git a/command/index.md b/command/README.md
similarity index 100%
rename from command/index.md
rename to command/README.md
diff --git a/composite/index.md b/composite/README.md
similarity index 100%
rename from composite/index.md
rename to composite/README.md
diff --git a/dao/index.md b/dao/README.md
similarity index 100%
rename from dao/index.md
rename to dao/README.md
diff --git a/decorator/index.md b/decorator/README.md
similarity index 100%
rename from decorator/index.md
rename to decorator/README.md
diff --git a/decorator/src/main/java/com/iluwatar/decorator/Troll.java b/decorator/src/main/java/com/iluwatar/decorator/Troll.java
index 7992d708d..628adda4b 100644
--- a/decorator/src/main/java/com/iluwatar/decorator/Troll.java
+++ b/decorator/src/main/java/com/iluwatar/decorator/Troll.java
@@ -29,6 +29,7 @@ package com.iluwatar.decorator;
*/
public class Troll implements Hostile {
+ @Override
public void attack() {
System.out.println("The troll swings at you with a club!");
}
@@ -38,6 +39,7 @@ public class Troll implements Hostile {
return 10;
}
+ @Override
public void fleeBattle() {
System.out.println("The troll shrieks in horror and runs away!");
}
diff --git a/delegation/index.md b/delegation/README.md
similarity index 100%
rename from delegation/index.md
rename to delegation/README.md
diff --git a/dependency-injection/index.md b/dependency-injection/README.md
similarity index 100%
rename from dependency-injection/index.md
rename to dependency-injection/README.md
diff --git a/double-checked-locking/index.md b/double-checked-locking/README.md
similarity index 100%
rename from double-checked-locking/index.md
rename to double-checked-locking/README.md
diff --git a/double-dispatch/index.md b/double-dispatch/README.md
similarity index 100%
rename from double-dispatch/index.md
rename to double-dispatch/README.md
diff --git a/event-aggregator/index.md b/event-aggregator/README.md
similarity index 100%
rename from event-aggregator/index.md
rename to event-aggregator/README.md
diff --git a/event-driven-architecture/index.md b/event-driven-architecture/README.md
similarity index 100%
rename from event-driven-architecture/index.md
rename to event-driven-architecture/README.md
diff --git a/execute-around/index.md b/execute-around/README.md
similarity index 100%
rename from execute-around/index.md
rename to execute-around/README.md
diff --git a/facade/index.md b/facade/README.md
similarity index 100%
rename from facade/index.md
rename to facade/README.md
diff --git a/factory-kit/index.md b/factory-kit/README.md
similarity index 100%
rename from factory-kit/index.md
rename to factory-kit/README.md
diff --git a/factory-method/index.md b/factory-method/README.md
similarity index 100%
rename from factory-method/index.md
rename to factory-method/README.md
diff --git a/feature-toggle/index.md b/feature-toggle/README.md
similarity index 100%
rename from feature-toggle/index.md
rename to feature-toggle/README.md
diff --git a/fluentinterface/index.md b/fluentinterface/README.md
similarity index 100%
rename from fluentinterface/index.md
rename to fluentinterface/README.md
diff --git a/flux/index.md b/flux/README.md
similarity index 100%
rename from flux/index.md
rename to flux/README.md
diff --git a/flyweight/index.md b/flyweight/README.md
similarity index 100%
rename from flyweight/index.md
rename to flyweight/README.md
diff --git a/front-controller/index.md b/front-controller/README.md
similarity index 100%
rename from front-controller/index.md
rename to front-controller/README.md
diff --git a/half-sync-half-async/index.md b/half-sync-half-async/README.md
similarity index 100%
rename from half-sync-half-async/index.md
rename to half-sync-half-async/README.md
diff --git a/intercepting-filter/index.md b/intercepting-filter/README.md
similarity index 100%
rename from intercepting-filter/index.md
rename to intercepting-filter/README.md
diff --git a/interpreter/index.md b/interpreter/README.md
similarity index 100%
rename from interpreter/index.md
rename to interpreter/README.md
diff --git a/iterator/index.md b/iterator/README.md
similarity index 100%
rename from iterator/index.md
rename to iterator/README.md
diff --git a/layers/index.md b/layers/README.md
similarity index 100%
rename from layers/index.md
rename to layers/README.md
diff --git a/lazy-loading/index.md b/lazy-loading/README.md
similarity index 100%
rename from lazy-loading/index.md
rename to lazy-loading/README.md
diff --git a/mediator/index.md b/mediator/README.md
similarity index 100%
rename from mediator/index.md
rename to mediator/README.md
diff --git a/memento/index.md b/memento/README.md
similarity index 100%
rename from memento/index.md
rename to memento/README.md
diff --git a/message-channel/index.md b/message-channel/README.md
similarity index 100%
rename from message-channel/index.md
rename to message-channel/README.md
diff --git a/model-view-controller/index.md b/model-view-controller/README.md
similarity index 100%
rename from model-view-controller/index.md
rename to model-view-controller/README.md
diff --git a/model-view-presenter/index.md b/model-view-presenter/README.md
similarity index 100%
rename from model-view-presenter/index.md
rename to model-view-presenter/README.md
diff --git a/monad/index.md b/monad/README.md
similarity index 97%
rename from monad/index.md
rename to monad/README.md
index 82deba922..ffc67a354 100644
--- a/monad/index.md
+++ b/monad/README.md
@@ -1,35 +1,35 @@
----
-layout: pattern
-title: Monad
-folder: monad
-permalink: /patterns/monad/
-categories: Other
-tags:
- - Java
- - Difficulty-Advanced
- - Functional
----
-
-## Intent
-
-Monad pattern based on monad from linear algebra represents the way of chaining operations
-together step by step. Binding functions can be described as passing one's output to another's input
-basing on the 'same type' contract. Formally, monad consists of a type constructor M and two
-operations:
-bind - that takes monadic object and a function from plain object to monadic value and returns monadic value
-return - that takes plain type object and returns this object wrapped in a monadic value.
-
-
-
-## Applicability
-
-Use the Monad in any of the following situations
-
-* when you want to chain operations easily
-* when you want to apply each function regardless of the result of any of them
-
-## Credits
-
-* [Design Pattern Reloaded by Remi Forax](https://youtu.be/-k2X7guaArU)
-* [Brian Beckman: Don't fear the Monad](https://channel9.msdn.com/Shows/Going+Deep/Brian-Beckman-Dont-fear-the-Monads)
+---
+layout: pattern
+title: Monad
+folder: monad
+permalink: /patterns/monad/
+categories: Other
+tags:
+ - Java
+ - Difficulty-Advanced
+ - Functional
+---
+
+## Intent
+
+Monad pattern based on monad from linear algebra represents the way of chaining operations
+together step by step. Binding functions can be described as passing one's output to another's input
+basing on the 'same type' contract. Formally, monad consists of a type constructor M and two
+operations:
+bind - that takes monadic object and a function from plain object to monadic value and returns monadic value
+return - that takes plain type object and returns this object wrapped in a monadic value.
+
+
+
+## Applicability
+
+Use the Monad in any of the following situations
+
+* when you want to chain operations easily
+* when you want to apply each function regardless of the result of any of them
+
+## Credits
+
+* [Design Pattern Reloaded by Remi Forax](https://youtu.be/-k2X7guaArU)
+* [Brian Beckman: Don't fear the Monad](https://channel9.msdn.com/Shows/Going+Deep/Brian-Beckman-Dont-fear-the-Monads)
* [Monad on Wikipedia](https://en.wikipedia.org/wiki/Monad_(functional_programming))
\ No newline at end of file
diff --git a/monostate/index.md b/monostate/README.md
similarity index 100%
rename from monostate/index.md
rename to monostate/README.md
diff --git a/multiton/index.md b/multiton/README.md
similarity index 100%
rename from multiton/index.md
rename to multiton/README.md
diff --git a/mute-idiom/README.md b/mute-idiom/README.md
new file mode 100644
index 000000000..efc09f306
--- /dev/null
+++ b/mute-idiom/README.md
@@ -0,0 +1,28 @@
+---
+layout: pattern
+title: Mute Idiom
+folder: mute-idiom
+permalink: /patterns/mute-idiom/
+categories: Other
+tags:
+ - Java
+ - Difficulty-Beginner
+ - Idiom
+---
+
+## Intent
+Provide a template to supress any exceptions that either are declared but cannot occur or should only be logged;
+while executing some business logic. The template removes the need to write repeated `try-catch` blocks.
+
+
+
+
+## Applicability
+Use this idiom when
+
+* an API declares some exception but can never throw that exception. Eg. ByteArrayOutputStream bulk write method.
+* you need to suppress some exception just by logging it, such as closing a resource.
+
+## Credits
+
+* [JOOQ: Mute Design Pattern](http://blog.jooq.org/2016/02/18/the-mute-design-pattern/)
diff --git a/mute-idiom/etc/mute-idiom.png b/mute-idiom/etc/mute-idiom.png
new file mode 100644
index 000000000..203bdafc4
Binary files /dev/null and b/mute-idiom/etc/mute-idiom.png differ
diff --git a/mute-idiom/etc/mute-idiom.ucls b/mute-idiom/etc/mute-idiom.ucls
new file mode 100644
index 000000000..7b4d2f916
--- /dev/null
+++ b/mute-idiom/etc/mute-idiom.ucls
@@ -0,0 +1,71 @@
+
+
+ *
+ * try {
+ * // code that may throwing exception we need to ignore or may never be thrown
+ * } catch (Exception ex) {
+ * // ignore by logging or throw error if unexpected exception occurs
+ * }
+ *
+ *
every time we need to ignore an exception.
+ *
+ */
+public class App {
+
+ /**
+ * Program entry point.
+ *
+ * @param args command line args.
+ * @throws Exception if any exception occurs
+ */
+ public static void main(String[] args) throws Exception {
+
+ useOfLoggedMute();
+
+ useOfMute();
+ }
+
+ /*
+ * Typically used when the API declares some exception but cannot do so. Usually a
+ * signature mistake.In this example out is not supposed to throw exception as it is a
+ * ByteArrayOutputStream. So we utilize mute, which will throw AssertionError if unexpected
+ * exception occurs.
+ */
+ private static void useOfMute() {
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ Mute.mute(() -> out.write("Hello".getBytes()));
+ }
+
+ private static void useOfLoggedMute() throws SQLException {
+ Resource resource = null;
+ try {
+ resource = acquireResource();
+ utilizeResource(resource);
+ } finally {
+ closeResource(resource);
+ }
+ }
+
+ /*
+ * All we can do while failed close of a resource is to log it.
+ */
+ private static void closeResource(Resource resource) {
+ Mute.loggedMute(() -> resource.close());
+ }
+
+ private static void utilizeResource(Resource resource) throws SQLException {
+ System.out.println("Utilizing acquired resource: " + resource);
+ }
+
+ private static Resource acquireResource() throws SQLException {
+ return new Resource() {
+
+ @Override
+ public void close() throws IOException {
+ throw new IOException("Error in closing resource: " + this);
+ }
+ };
+ }
+}
diff --git a/mute-idiom/src/main/java/com/iluwatar/mute/CheckedRunnable.java b/mute-idiom/src/main/java/com/iluwatar/mute/CheckedRunnable.java
new file mode 100644
index 000000000..d1440636f
--- /dev/null
+++ b/mute-idiom/src/main/java/com/iluwatar/mute/CheckedRunnable.java
@@ -0,0 +1,37 @@
+/**
+ * The MIT License
+ * Copyright (c) 2014 Ilkka Seppälä
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+package com.iluwatar.mute;
+
+/**
+ * A runnable which may throw exception on execution.
+ *
+ */
+@FunctionalInterface
+public interface CheckedRunnable {
+ /**
+ * Same as {@link Runnable#run()} with a possibility of exception in execution.
+ * @throws Exception if any exception occurs.
+ */
+ void run() throws Exception;
+}
diff --git a/mute-idiom/src/main/java/com/iluwatar/mute/Mute.java b/mute-idiom/src/main/java/com/iluwatar/mute/Mute.java
new file mode 100644
index 000000000..64169a8f5
--- /dev/null
+++ b/mute-idiom/src/main/java/com/iluwatar/mute/Mute.java
@@ -0,0 +1,68 @@
+/**
+ * The MIT License
+ * Copyright (c) 2014 Ilkka Seppälä
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+package com.iluwatar.mute;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+
+/**
+ * A utility class that allows you to utilize mute idiom.
+ */
+public final class Mute {
+
+ // The constructor is never meant to be called.
+ private Mute() {}
+
+ /**
+ * Executes the runnable
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 because the bulk write method is not overridden
+ * in {@link ByteArrayOutputStream}.
+ *
+ * @param runnable a runnable that should never throw an exception on execution.
+ */
+ public static void mute(CheckedRunnable runnable) {
+ try {
+ runnable.run();
+ } catch (Exception e) {
+ throw new AssertionError(e);
+ }
+ }
+
+ /**
+ * Executes the runnable
and logs the exception occurred on {@link System#err}.
+ * This method should be utilized to mute the operations about which most you can do is log.
+ * For instance while closing a connection to database, or cleaning up a resource,
+ * all you can do is log the exception occurred.
+ *
+ * @param runnable a runnable that may throw an exception on execution.
+ */
+ public static void loggedMute(CheckedRunnable runnable) {
+ try {
+ runnable.run();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/mute-idiom/src/main/java/com/iluwatar/mute/Resource.java b/mute-idiom/src/main/java/com/iluwatar/mute/Resource.java
new file mode 100644
index 000000000..6970d06bc
--- /dev/null
+++ b/mute-idiom/src/main/java/com/iluwatar/mute/Resource.java
@@ -0,0 +1,35 @@
+/**
+ * The MIT License
+ * Copyright (c) 2014 Ilkka Seppälä
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+package com.iluwatar.mute;
+
+import java.io.Closeable;
+
+/**
+ * Represents any resource that the application might acquire and that must be closed
+ * after it is utilized. Example of such resources can be a database connection, open
+ * files, sockets.
+ */
+public interface Resource extends Closeable {
+
+}
diff --git a/mute-idiom/src/test/java/com/iluwatar/mute/AppTest.java b/mute-idiom/src/test/java/com/iluwatar/mute/AppTest.java
new file mode 100644
index 000000000..8075d9c85
--- /dev/null
+++ b/mute-idiom/src/test/java/com/iluwatar/mute/AppTest.java
@@ -0,0 +1,38 @@
+/**
+ * The MIT License
+ * Copyright (c) 2014 Ilkka Seppälä
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+package com.iluwatar.mute;
+
+import org.junit.Test;
+
+/**
+ * Tests that Mute idiom example runs without errors.
+ *
+ */
+public class AppTest {
+
+ @Test
+ public void test() throws Exception {
+ App.main(null);
+ }
+}
diff --git a/mute-idiom/src/test/java/com/iluwatar/mute/MuteTest.java b/mute-idiom/src/test/java/com/iluwatar/mute/MuteTest.java
new file mode 100644
index 000000000..58cbfe893
--- /dev/null
+++ b/mute-idiom/src/test/java/com/iluwatar/mute/MuteTest.java
@@ -0,0 +1,78 @@
+/**
+ * The MIT License
+ * Copyright (c) 2014 Ilkka Seppälä
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+package com.iluwatar.mute;
+
+import static org.junit.Assert.assertTrue;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.PrintStream;
+
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+
+public class MuteTest {
+
+ private static final String MESSAGE = "should not occur";
+
+ @Rule public ExpectedException exception = ExpectedException.none();
+
+ @Test
+ public void muteShouldRunTheCheckedRunnableAndNotThrowAnyExceptionIfCheckedRunnableDoesNotThrowAnyException() {
+ Mute.mute(() -> methodNotThrowingAnyException());
+ }
+
+ @Test
+ public void muteShouldRethrowUnexpectedExceptionAsAssertionError() throws Exception {
+ exception.expect(AssertionError.class);
+ exception.expectMessage(MESSAGE);
+
+ Mute.mute(() -> methodThrowingException());
+ }
+
+ @Test
+ public void loggedMuteShouldRunTheCheckedRunnableAndNotThrowAnyExceptionIfCheckedRunnableDoesNotThrowAnyException() {
+ Mute.loggedMute(() -> methodNotThrowingAnyException());
+ }
+
+ @Test
+ public void loggedMuteShouldLogExceptionTraceBeforeSwallowingIt() throws IOException {
+ ByteArrayOutputStream stream = new ByteArrayOutputStream();
+ System.setErr(new PrintStream(stream));
+
+ Mute.loggedMute(() -> methodThrowingException());
+
+ assertTrue(new String(stream.toByteArray()).contains(MESSAGE));
+ }
+
+
+ private void methodNotThrowingAnyException() {
+ System.out.println("Executed successfully");
+ }
+
+ private void methodThrowingException() throws Exception {
+ throw new Exception(MESSAGE);
+ }
+}
diff --git a/naked-objects/index.md b/naked-objects/README.md
similarity index 100%
rename from naked-objects/index.md
rename to naked-objects/README.md
diff --git a/null-object/index.md b/null-object/README.md
similarity index 100%
rename from null-object/index.md
rename to null-object/README.md
diff --git a/object-pool/index.md b/object-pool/README.md
similarity index 100%
rename from object-pool/index.md
rename to object-pool/README.md
diff --git a/observer/index.md b/observer/README.md
similarity index 100%
rename from observer/index.md
rename to observer/README.md
diff --git a/poison-pill/index.md b/poison-pill/README.md
similarity index 100%
rename from poison-pill/index.md
rename to poison-pill/README.md
diff --git a/pom.xml b/pom.xml
index 524a0261b..9127a865a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -124,6 +124,7 @@