title: Try Catch block works but test assertThrows fail (Junit 5)
body: <p>I am trying to follow this tutorial <a href="https://stackoverflow.com/questions/40268446/junit-5-how-to-assert-an-exception-is-thrown">JUnit 5: How to assert an exception is thrown?</a></p>
  
  <p>I use Java 10, IntelliJ 2018 and Junit 5.</p>
  
  <p>I make a calculator app that adds 2 fractions. It checks whether the input has 0 in the denominator.</p>
  
  <p>When I run the test The exception Message get printed out "Undefined Math Expression" but my IDE says "Expected java.lang.Throwable to be thrown, but nothing was thrown." I think there is some problem with the scope of my code? I'm a newbie, please be kind. I provided the code and the test below:</p>
  
  <pre><code>public class Calculator {
      public static int[] calculate (int firstNumerator, int firstDenominator, int secondNumerator, int secondDenominator) {
  
          String exceptionMessage = "Undefined Math Expression";
          int resultNumerator;
          int resultDenominator;
          int[] result = new int[2];
  
          resultNumerator =  (firstNumerator * secondDenominator) +
                  (secondNumerator * firstDenominator);
          resultDenominator = firstDenominator * secondDenominator;
  
          try {
              if (resultDenominator == 0) {
                    throw (new Throwable(exceptionMessage));
              } else {
                  result[0] = resultNumerator;
                  result[1] = resultDenominator;
              }
          } catch (Throwable e) {
             System.out.println(e.getMessage());
          }
  
          return result;
      }
  }
  </code></pre>
  
  <p>The test:</p>
  
  <pre><code>class CalculatorTest {
      @Test
      void denominatorContainsZero() {
          assertThrows(Throwable.class, () -&gt; {
              Calculator.calculate(0,0,0,0);
          });
      }
  }
  </code></pre>