Skip to content

Commit

Permalink
refactor: automatic refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
remcowesterhoud committed Feb 25, 2022
1 parent d012d87 commit fae0ab9
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,11 @@ record -> {
stringBuilder.append(summarizeIncident(record)).append(System.lineSeparator());
}
});
stringBuilder.append(System.lineSeparator())
.append("If you did not expect any incidents to occur, then we recommend investigating"
+ "these. These incidents may indicate what went wrong in your test case")
stringBuilder
.append(System.lineSeparator())
.append(
"If you did not expect any incidents to occur, then we recommend investigating"
+ "these. These incidents may indicate what went wrong in your test case")
.append(System.lineSeparator());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,15 @@ public RecordStreamLogger(final RecordStreamSource recordStreamSource) {
valueTypeLoggers.put(ValueType.JOB_BATCH, this::logJobBatchRecordValue);
valueTypeLoggers.put(ValueType.TIMER, this::logTimerRecordValue);
valueTypeLoggers.put(
ValueType.MESSAGE_START_EVENT_SUBSCRIPTION, this::logMessageStartEventSubscriptionRecordValue);
ValueType.MESSAGE_START_EVENT_SUBSCRIPTION,
this::logMessageStartEventSubscriptionRecordValue);
valueTypeLoggers.put(ValueType.VARIABLE, this::logVariableRecordValue);
valueTypeLoggers.put(ValueType.VARIABLE_DOCUMENT, this::logVariableDocumentRecordValue);
valueTypeLoggers.put(
ValueType.PROCESS_INSTANCE_CREATION, this::logProcessInstanceCreationRecordValue);
valueTypeLoggers.put(ValueType.ERROR, this::logErrorRecordValue);
valueTypeLoggers.put(ValueType.PROCESS_INSTANCE_RESULT, this::logProcessInstanceResultRecordValue);
valueTypeLoggers.put(
ValueType.PROCESS_INSTANCE_RESULT, this::logProcessInstanceResultRecordValue);
valueTypeLoggers.put(ValueType.PROCESS, this::logProcessRecordValue);
valueTypeLoggers.put(ValueType.PROCESS_EVENT, this::logProcessEventRecordValue);

Expand All @@ -79,9 +81,7 @@ private void logRecords(final StringBuilder stringBuilder) {
record -> {
stringBuilder.append(logGenericRecord(record));
stringBuilder.append(
valueTypeLoggers
.getOrDefault(record.getValueType(), var -> "")
.apply(record));
valueTypeLoggers.getOrDefault(record.getValueType(), var -> "").apply(record));
});

LOG.info(stringBuilder.toString());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package io.camunda.zeebe.process.test.filters.logger;


import io.camunda.zeebe.protocol.record.Record;
import io.camunda.zeebe.protocol.record.ValueType;
import java.util.Arrays;
Expand All @@ -18,9 +17,12 @@ void testAllValueTypesAreMapped() {

final SoftAssertions softly = new SoftAssertions();
Arrays.asList(ValueType.values())
.forEach(valueType -> softly.assertThat(valueTypeLoggers.containsKey(valueType))
.withFailMessage("No value type logger defined for value type '%s'", valueType)
.isTrue());
.forEach(
valueType ->
softly
.assertThat(valueTypeLoggers.containsKey(valueType))
.withFailMessage("No value type logger defined for value type '%s'", valueType)
.isTrue());

softly.assertAll();
}
Expand Down

0 comments on commit fae0ab9

Please sign in to comment.