Лаб. работа №2

This commit is contained in:
Katerina881 2023-04-25 13:13:48 +04:00
parent 3f7833f81a
commit a2317af4cc
4 changed files with 7 additions and 3 deletions

View File

@ -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">

View File

@ -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;

View File

@ -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) {

View File

@ -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