/
NikolayIvkin
/
TheAlgorithms
Обзор
Документация
Войти
/
NikolayIvkin
/
TheAlgorithms
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
src/test/java/com/thealgorithms/maths/FactorialTest.java
24 строки
858 B
Piotr Idzik
style: avoid wildcard imports (#4386)
20 сен 2023, 20:38
Не верифицирован
20 сен 2023, 20:38
906cd87
Код
Авторство
О чём код?
package com.thealgorithms.maths; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertThrows; import org.junit.jupiter.api.Test; public class FactorialTest { private static final String EXCEPTION_MESSAGE = "Input number cannot be negative"; @Test public void testWhenInvalidInoutProvidedShouldThrowException() { IllegalArgumentException exception = assertThrows(IllegalArgumentException.class, () -> Factorial.factorial(-1)); assertEquals(exception.getMessage(), EXCEPTION_MESSAGE); } @Test public void testCorrectFactorialCalculation() { assertEquals(1, Factorial.factorial(0)); assertEquals(1, Factorial.factorial(1)); assertEquals(120, Factorial.factorial(5)); assertEquals(3628800, Factorial.factorial(10)); } }