Лаб. работа №2
This commit is contained in:
parent
3f7833f81a
commit
a2317af4cc
@ -12,7 +12,7 @@
|
||||
<div class="col-md-2 m-2 p-0">
|
||||
<select class="form-control" id="type">
|
||||
<option value="int" selected>Числа</option>
|
||||
<option value="str">Строки</option>
|
||||
<option value="string">Строки</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-2 m-2 p-0">
|
||||
|
@ -3,6 +3,7 @@ import com.labs.LabWork.Calculator.Service.CalculatorService;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
@RestController
|
||||
public class CalculatorController {
|
||||
private final CalculatorService calculatorService;
|
||||
|
||||
|
@ -1,5 +1,8 @@
|
||||
package com.labs.LabWork.Calculator.Domain;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component(value = "string")
|
||||
public class StringCalculator implements ICalculator<String> {
|
||||
@Override
|
||||
public String sum(String s1, String s2) {
|
||||
|
@ -61,8 +61,8 @@ class LabWorkApplicationTests {
|
||||
|
||||
@Test
|
||||
void testStringDiv(){
|
||||
final Object res = calculatorService.division("15", "24", "string");
|
||||
Assertions.assertEquals("1245", res.toString());
|
||||
final Object res = calculatorService.division("124", "24", "string");
|
||||
Assertions.assertEquals("1", res.toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
Loading…
Reference in New Issue
Block a user