Work on #385, added documentation and class diagram. Made refactoring changes to pass checkstyle and PMD checks
This commit is contained in:
@ -9,7 +9,7 @@ import org.junit.Test;
|
||||
public class AppTest {
|
||||
|
||||
@Test
|
||||
public void test() {
|
||||
public void test() throws Exception {
|
||||
App.main(null);
|
||||
}
|
||||
}
|
||||
|
@ -20,6 +20,7 @@
|
||||
* 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;
|
||||
@ -38,6 +39,11 @@ public class MuteTest {
|
||||
|
||||
@Rule public ExpectedException exception = ExpectedException.none();
|
||||
|
||||
@Test
|
||||
public void muteShouldRunTheCheckedRunnableAndNotThrowAnyExceptionIfCheckedRunnableDoesNotThrowAnyException() {
|
||||
Mute.mute(() -> methodNotThrowingAnyException());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void muteShouldRethrowUnexpectedExceptionAsAssertionError() throws Exception {
|
||||
exception.expect(AssertionError.class);
|
||||
@ -46,8 +52,9 @@ public class MuteTest {
|
||||
Mute.mute(() -> methodThrowingException());
|
||||
}
|
||||
|
||||
private void methodThrowingException() throws Exception {
|
||||
throw new Exception(MESSAGE);
|
||||
@Test
|
||||
public void loggedMuteShouldRunTheCheckedRunnableAndNotThrowAnyExceptionIfCheckedRunnableDoesNotThrowAnyException() {
|
||||
Mute.loggedMute(() -> methodNotThrowingAnyException());
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -59,4 +66,13 @@ public class MuteTest {
|
||||
|
||||
assertTrue(new String(stream.toByteArray()).contains(MESSAGE));
|
||||
}
|
||||
|
||||
|
||||
private void methodNotThrowingAnyException() {
|
||||
System.out.println("Executed successfully");
|
||||
}
|
||||
|
||||
private void methodThrowingException() throws Exception {
|
||||
throw new Exception(MESSAGE);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user