mirror of
https://bitbucket.org/Mattrixwv/projecteulerjava.git
synced 2025-12-06 17:13:58 -05:00
56 lines
1.1 KiB
Java
56 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 TestProblem23 extends BaseTest{
|
|
@InjectMocks
|
|
private Problem23Override problem;
|
|
static{
|
|
description = "Find the sum of all the positive integers which cannot be written as the sum of two abundant numbers";
|
|
result = "The answer is 2035227";
|
|
}
|
|
|
|
|
|
@Test
|
|
@Order(1)
|
|
@Override
|
|
public void testDescription(){
|
|
super.testDescription(problem);
|
|
}
|
|
|
|
@Test
|
|
@Order(2)
|
|
@Override
|
|
public void testSolve(){
|
|
assertThrows(Unsolved.class, () -> { problem.getSum(); });
|
|
|
|
super.testSolve(problem);
|
|
|
|
//Verify result
|
|
assertEquals(2035227, problem.getSum());
|
|
}
|
|
|
|
@Test
|
|
@Order(3)
|
|
@Override
|
|
public void testReset(){
|
|
super.testReset(problem);
|
|
}
|
|
|
|
|
|
public static class Problem23Override extends Problem23{
|
|
static{
|
|
maxNum = 5000;
|
|
}
|
|
}
|
|
}
|