mirror of
https://bitbucket.org/Mattrixwv/projecteulerjava.git
synced 2025-12-06 17:13:58 -05:00
51 lines
1.1 KiB
Java
51 lines
1.1 KiB
Java
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 TestProblem4 extends BaseTest{
|
|
@InjectMocks
|
|
private Problem4 problem;
|
|
static{
|
|
description = "Find the largest palindrome made from the product of two 3-digit numbers";
|
|
result = "The largest palindrome is 906609";
|
|
}
|
|
|
|
|
|
@Test
|
|
@Order(1)
|
|
@Override
|
|
public void testDescription(){
|
|
super.testDescription(problem);
|
|
}
|
|
|
|
@Test
|
|
@Order(2)
|
|
@Override
|
|
public void testSolve(){
|
|
assertThrows(Unsolved.class, () -> { problem.getPalindromes(); });
|
|
assertThrows(Unsolved.class, () -> { problem.getLargestPalindrome(); });
|
|
|
|
super.testSolve(problem);
|
|
|
|
//verify result
|
|
assertEquals(1239, problem.getPalindromes().size());
|
|
assertEquals(906609, problem.getLargestPalindrome());
|
|
}
|
|
|
|
@Test
|
|
@Order(3)
|
|
@Override
|
|
public void testReset(){
|
|
super.testReset(problem);
|
|
}
|
|
}
|