ЛР2 добавление теста
This commit is contained in:
parent
aac82d37ee
commit
46ecf5eac3
@ -2,8 +2,6 @@ package ru.ulstu.is.lab1;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@SpringBootApplication
|
||||
|
@ -17,12 +17,10 @@ public class MethodInt implements IMethod<Integer>{
|
||||
}
|
||||
|
||||
public Integer Comparison(Integer first, Integer second) {
|
||||
int num1 = first;
|
||||
int num2 = second;
|
||||
if (num1 >= num2){
|
||||
return num1;
|
||||
if (first >= second){
|
||||
return first;
|
||||
}else{
|
||||
return num2;
|
||||
return second;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package ru.ulstu.is.lab1;
|
||||
|
||||
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
|
||||
import ru.ulstu.is.lab1.speaker.service.MethodService;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@ -55,4 +56,9 @@ class Lab1ApplicationTests {
|
||||
final String res = methodService.Com("846734", "312", "string");
|
||||
Assertions.assertEquals("846734", res);
|
||||
}
|
||||
@Test
|
||||
void testNumberFormatException() {
|
||||
final String res = methodService.Sum("п", 3, "int");
|
||||
Assertions.assertThrows(NumberFormatException.class, () -> methodService.Sum(5, 3, "int"));
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user