mirror of
https://bitbucket.org/Mattrixwv/projecteulerjava.git
synced 2025-12-06 17:13:58 -05:00
Finished adding tests
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
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 TestProblem46 extends BaseTest{
|
||||
@InjectMocks
|
||||
private Problem46 problem;
|
||||
static{
|
||||
description = "What is the smallest odd composite number that connot be written as the sum of a prime and twice a square?";
|
||||
result = "The smallest odd composite that cannot be written as the sum of a prime and twice a square is 5777";
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
@Order(1)
|
||||
@Override
|
||||
public void testDescription(){
|
||||
super.testDescription(problem);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(2)
|
||||
@Override
|
||||
public void testSolve(){
|
||||
assertThrows(Unsolved.class, () -> { problem.getCompositeNum(); });
|
||||
|
||||
super.testSolve(problem);
|
||||
|
||||
//Verify result
|
||||
assertEquals(5777, problem.getCompositeNum());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Order(3)
|
||||
@Override
|
||||
public void testReset(){
|
||||
super.testReset(problem);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user