This commit is contained in:
Калышев Ян 2023-06-15 20:57:51 +04:00
parent edbbe4d2b1
commit 7545b7e1fa
2 changed files with 5 additions and 1 deletions

View File

@ -23,6 +23,7 @@ public class MakerService {
} else if (type.equals("string")) {
return maker.plus(value1.toString(), value2.toString());
}
return null;
}
public Object minus(Object value1, Object value2, String type) {
final Maker maker = (Maker) applicationContext.getBean(type);
@ -31,6 +32,7 @@ public class MakerService {
} else if (type.equals("string")) {
return maker.minus(value1.toString(), value2.toString());
}
return null;
}
public Object multiply(Object value1, Object value2, String type) {
final Maker maker = (Maker) applicationContext.getBean(type);
@ -39,6 +41,7 @@ public class MakerService {
} else if (type.equals("string")) {
return maker.multiply(value1.toString(), Integer.valueOf(value2.toString()));
}
return null;
}
public Object divide(Object value1, Object value2, String type) {
final Maker maker = (Maker) applicationContext.getBean(type);
@ -47,5 +50,6 @@ public class MakerService {
} else if (type.equals("string")) {
return maker.divide(value1.toString(), Integer.valueOf(value2.toString()));
}
return null;
}
}

View File

@ -55,7 +55,7 @@ class YanApplicationTests {
@Test
void testMakerStringDivideFalse() {
final Object res = makerService.divide("12345678", 4, "string");
Assertions.assertEquals("12 ; 34 ; 56 ; 78 ;", res);
Assertions.assertEquals("12 ; 34 ; 56 ; 78 ; ", res);
}
@Test
void testSpeakerFalseBean() {