package com.mattrixwv.project_euler.problems; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertThrows; import org.junit.jupiter.api.Order; import org.junit.jupiter.api.Test; import org.mockito.InjectMocks; import com.mattrixwv.project_euler.exceptions.Unsolved; public class TestProblem6 extends BaseTest{ @InjectMocks private Problem6 problem; static{ description = "Find the difference between the sum of the squares and the square of the sum of the numbers 1-100."; result = "The difference between the sum of the squares and the square of the sum of all numbers from 1-100 is 25164150"; } @Test @Order(1) @Override public void testDescription(){ super.testDescription(problem); } @Test @Order(2) @Override public void testSolve(){ assertThrows(Unsolved.class, () -> { problem.getSumOfSquares(); }); assertThrows(Unsolved.class, () -> { problem.getSquareOfSum(); }); assertThrows(Unsolved.class, () -> { problem.getDifference(); }); problem.solve(); //Verify result assertEquals(338350, problem.getSumOfSquares()); assertEquals(25502500, problem.getSquareOfSum()); assertEquals(25164150, problem.getDifference()); } @Test @Order(3) @Override public void testReset(){ super.testReset(problem); } }