Skip to content

Commit 578bc49

Browse files
committed
Addressed review comments
Signed-off-by: Krishna Kondaka <krishkdk@amazon.com>
1 parent d5b740e commit 578bc49

1 file changed

Lines changed: 23 additions & 4 deletions

File tree

  • data-prepper-plugins/mutate-event-processors/src/test/java/org/opensearch/dataprepper/plugins/processor/mutateevent

data-prepper-plugins/mutate-event-processors/src/test/java/org/opensearch/dataprepper/plugins/processor/mutateevent/RenameKeyProcessorTests.java

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ void invalid_rename_when_throws_InvalidPluginConfigurationException() {
6565
}
6666

6767
@Test
68-
void invalid_config_tests_with_entries_and_transform_options() throws NoSuchFieldException, IllegalAccessException {
68+
void invalid_config_tests_with_entries_and_transform_options_both_present() throws NoSuchFieldException, IllegalAccessException {
6969
final String renameWhen = UUID.randomUUID().toString();
7070
List<RenameKeyProcessorConfig.Entry> entries = createListOfEntries(createEntry("message", null,"newMessage", true, renameWhen));
7171

@@ -74,13 +74,32 @@ void invalid_config_tests_with_entries_and_transform_options() throws NoSuchFiel
7474
ReflectivelySetField.setField(RenameKeyProcessorConfig.class, renameKeyProcessorConfig, "entries", entries);
7575
ReflectivelySetField.setField(RenameKeyProcessorConfig.class, renameKeyProcessorConfig, "transformOption", TransformOption.LOWERCASE);
7676
assertFalse(renameKeyProcessorConfig.isValidConfig());
77+
}
78+
79+
@Test
80+
void invalid_config_tests_with_entries_and_transform_options_both_not_present() throws NoSuchFieldException, IllegalAccessException {
81+
RenameKeyProcessorConfig renameKeyProcessorConfig = new RenameKeyProcessorConfig();
82+
ReflectivelySetField.setField(RenameKeyProcessorConfig.class, renameKeyProcessorConfig, "entries", null);
83+
ReflectivelySetField.setField(RenameKeyProcessorConfig.class, renameKeyProcessorConfig, "transformOption", TransformOption.NONE);
84+
assertFalse(renameKeyProcessorConfig.isValidConfig());
85+
}
86+
87+
@Test
88+
void invalid_config_tests_with_entries_and_transform_options_valid_entries() throws NoSuchFieldException, IllegalAccessException {
89+
final String renameWhen = UUID.randomUUID().toString();
90+
List<RenameKeyProcessorConfig.Entry> entries = createListOfEntries(createEntry("message", null,"newMessage", true, renameWhen));
91+
RenameKeyProcessorConfig renameKeyProcessorConfig = new RenameKeyProcessorConfig();
92+
ReflectivelySetField.setField(RenameKeyProcessorConfig.class, renameKeyProcessorConfig, "entries", entries);
7793
ReflectivelySetField.setField(RenameKeyProcessorConfig.class, renameKeyProcessorConfig, "transformOption", TransformOption.NONE);
7894
assertTrue(renameKeyProcessorConfig.isValidConfig());
79-
ReflectivelySetField.setField(RenameKeyProcessorConfig.class, renameKeyProcessorConfig, "transformOption", TransformOption.LOWERCASE);
95+
}
96+
97+
@Test
98+
void invalid_config_tests_with_entries_and_transform_options_valid_transformation() throws NoSuchFieldException, IllegalAccessException {
99+
RenameKeyProcessorConfig renameKeyProcessorConfig = new RenameKeyProcessorConfig();
80100
ReflectivelySetField.setField(RenameKeyProcessorConfig.class, renameKeyProcessorConfig, "entries", null);
101+
ReflectivelySetField.setField(RenameKeyProcessorConfig.class, renameKeyProcessorConfig, "transformOption", TransformOption.UPPERCASE);
81102
assertTrue(renameKeyProcessorConfig.isValidConfig());
82-
ReflectivelySetField.setField(RenameKeyProcessorConfig.class, renameKeyProcessorConfig, "transformOption", TransformOption.NONE);
83-
assertFalse(renameKeyProcessorConfig.isValidConfig());
84103
}
85104

86105
@Test

0 commit comments

Comments
 (0)