Skip to content
Snippets Groups Projects
Commit 0657c181 authored by Felix Reichenbach's avatar Felix Reichenbach
Browse files

OZG-7515 extract Strings to constants

parent 24b92e89
No related branches found
No related tags found
1 merge request!11Ozg 7515 migrate patch item command
......@@ -43,6 +43,12 @@ import de.ozgcloud.vorgang.command.PersistedCommand;
@DataITCase
class M014_AddItemNameBescheidToPatchAttachedItemCommandITCase {
private static final String BESCHEID_ITEM_NAME = "Bescheid";
private static final String ITEM_NAME_FIELD = "itemName";
private static final String PATCH_ATTACHED_ITEM_ORDER = "PATCH_ATTACHED_ITEM";
private static final String PARENT_ID_FIELD = "parentId";
private static final String SEND_BESCHEID_ORDER = "SEND_BESCHEID";
@InjectMocks
private M014_AddItemNameBescheidToPatchAttachedItemCommand migration;
@Autowired
......@@ -70,22 +76,22 @@ class M014_AddItemNameBescheidToPatchAttachedItemCommandITCase {
}
private PersistedCommand saveSendBescheidCommand() {
var command = CommandTestFactory.createBuilder().id(null).order("SEND_BESCHEID").build();
var command = CommandTestFactory.createBuilder().id(null).order(SEND_BESCHEID_ORDER).build();
return mongoOperations.save(command);
}
private PersistedCommand savePatchAttachedItemSubCommand(String id) {
Map<String, Object> itemBody = Map.of("parentId", id);
Map<String, Object> itemBody = Map.of(PARENT_ID_FIELD, id);
var command = CommandTestFactory.createBuilder()
.id(null)
.order("PATCH_ATTACHED_ITEM")
.order(PATCH_ATTACHED_ITEM_ORDER)
.bodyObject(itemBody)
.build();
return mongoOperations.save(command);
}
private PersistedCommand saveOtherSubCommand(String id) {
Map<String, Object> itemBody = Map.of("parentId", id);
Map<String, Object> itemBody = Map.of(PARENT_ID_FIELD, id);
var command = CommandTestFactory.createBuilder()
.id(null)
.bodyObject(itemBody)
......@@ -96,14 +102,14 @@ class M014_AddItemNameBescheidToPatchAttachedItemCommandITCase {
private PersistedCommand saveOtherPatchAttachedItemSubCommand() {
var command = CommandTestFactory.createBuilder()
.id(null)
.order("PATCH_ATTACHED_ITEM")
.order(PATCH_ATTACHED_ITEM_ORDER)
.build();
return mongoOperations.save(command);
}
private PersistedCommand buildExpectedPatchAttachedItemCommand(Command patchAttachedItemCommand) {
var body = new HashMap<>(patchAttachedItemCommand.getBodyObject());
body.put("itemName", "Bescheid");
body.put(ITEM_NAME_FIELD, BESCHEID_ITEM_NAME);
return CommandTestFactory.createBuilder()
.id(patchAttachedItemCommand.getId())
.order(patchAttachedItemCommand.getOrder())
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment