clearing-validation поправил сообщение об ошибке 1010
This commit is contained in:
parent
bc0f95e032
commit
79f0650417
3 changed files with 76 additions and 3 deletions
|
|
@ -73,8 +73,8 @@
|
|||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.skyscreamer</groupId>
|
||||
<artifactId>jsonassert</artifactId>
|
||||
<groupId>org.mockito</groupId>
|
||||
<artifactId>mockito-core</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
|
@ -91,5 +91,11 @@
|
|||
<groupId>ru.spcex.platform</groupId>
|
||||
<artifactId>platform-messaging</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-simple</artifactId>
|
||||
<version>1.7.33</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
|
@ -0,0 +1,67 @@
|
|||
package ru.spcex.clearing.util.services;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.mockito.Mockito;
|
||||
import ru.clearing.platform.dictionary.ErrorCodeDictionary;
|
||||
import ru.spcex.clearing.imdg.IMDGDistributedNames;
|
||||
import ru.spcex.platform.imdg.api.Imdg;
|
||||
import ru.spcex.platform.imdg.api.ImdgProvider;
|
||||
import ru.spcex.platform.utils.enumeration.EnumMessage;
|
||||
import ru.spcex.platform.utils.enumeration.IErrorEnumId;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
class IMDGMessageResolverTest {
|
||||
|
||||
@Test
|
||||
void resolve() {
|
||||
ImdgProvider imdgProvider = Mockito.mock(ImdgProvider.class);
|
||||
Imdg<ErrorCodeDictionary> errorCodeDictionary = Mockito.mock(Imdg.class);
|
||||
ErrorCodeDictionary error1Dict = new ErrorCodeDictionary();
|
||||
error1Dict.setId(1L);
|
||||
error1Dict.setCode("TEST");
|
||||
error1Dict.setName("Error 1 test. Two arg %s, %s.");
|
||||
Mockito.when(errorCodeDictionary.getSingleObjectByID(1L)).thenReturn(error1Dict);
|
||||
Mockito.when(imdgProvider.getImdg(IMDGDistributedNames.Map_ErrorCodeDictionary, ErrorCodeDictionary.class))
|
||||
.thenReturn(errorCodeDictionary);
|
||||
|
||||
|
||||
IMDGMessageResolver resolver = new IMDGMessageResolver(imdgProvider);
|
||||
|
||||
IErrorEnumId err1 = ClearingErrorInternalTest.TestError;
|
||||
{
|
||||
String text = resolver.resolve(new EnumMessage(err1, "a", "and", "b"));
|
||||
assertEquals("Error 1 test. Two arg a, and.", text);
|
||||
}
|
||||
{
|
||||
String text = resolver.resolve(new EnumMessage(err1, "a", "and"));
|
||||
assertEquals("Error 1 test. Two arg a, and.", text);
|
||||
}
|
||||
{
|
||||
String text = resolver.resolve(new EnumMessage(err1, "one only this"));
|
||||
//assertEquals("Error 1 test. Two arg one only this, %s.", text);
|
||||
// java.util.MissingFormatArgumentException: Format specifier '%s'
|
||||
assertEquals("(1) args [one only this]", text);
|
||||
}
|
||||
{
|
||||
String text = resolver.resolve(new EnumMessage(err1));
|
||||
//assertEquals("Error 1 test. Two arg %s, %s.", text);
|
||||
// java.util.MissingFormatArgumentException: Format specifier '%s'
|
||||
assertEquals("(1) args []", text);
|
||||
}
|
||||
}
|
||||
|
||||
static enum ClearingErrorInternalTest implements IErrorEnumId { // see ClearingErrorInternal
|
||||
TestError(1L);
|
||||
private final Long id;
|
||||
|
||||
ClearingErrorInternalTest(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -36,7 +36,7 @@ public class NotPresentBySecuritySymbolAndWorkflowStatusActv<T extends SpcexObje
|
|||
"securitySymbol", action.getSecuritySymbol(),
|
||||
"workflowStatus", WorkflowStatus.Active.getKey()));
|
||||
if (object != null) {
|
||||
return of(errorEnum);
|
||||
return of(errorEnum, action.getSecuritySymbol());
|
||||
} else {
|
||||
return empty();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue