Skip to content

Commit 88590ec

Browse files
authored
Change to not initialize collections by default on generated POJOs (#206)
Signed-off-by: Helber Belmiro <[email protected]>
1 parent 61ee63e commit 88590ec

File tree

3 files changed

+34
-2
lines changed

3 files changed

+34
-2
lines changed

api/pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@
9797
<outputDirectory>${project.build.directory}/generated-sources/src/main/java</outputDirectory>
9898
<includeJsr303Annotations>true</includeJsr303Annotations>
9999
<generateBuilders>true</generateBuilders>
100+
<initializeCollections>false</initializeCollections>
100101
<includeAdditionalProperties>false</includeAdditionalProperties>
101102
<includeToString>false</includeToString>
102103
<includeHashcodeAndEquals>false</includeHashcodeAndEquals>
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/*
2+
* Copyright 2020-Present The Serverless Workflow Specification Authors
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package io.serverlessworkflow.api.test;
17+
18+
import static org.assertj.core.api.Assertions.assertThat;
19+
20+
import io.serverlessworkflow.api.Workflow;
21+
import io.serverlessworkflow.api.test.utils.WorkflowTestUtils;
22+
import org.junit.jupiter.api.Test;
23+
24+
class CodegenTest {
25+
26+
@Test
27+
void collectionsShouldNotBeInitializedByDefault() {
28+
Workflow workflow =
29+
Workflow.fromSource(WorkflowTestUtils.readWorkflowFile("/features/functionrefs.json"));
30+
assertThat(workflow.getAnnotations()).isNull();
31+
}
32+
}

api/src/test/java/io/serverlessworkflow/api/test/MarkupToWorkflowTest.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,8 +225,7 @@ public void testTransitions(String workflowLocation) {
225225
DefaultConditionDefinition defaultDefinition = switchState.getDefaultCondition();
226226
assertNotNull(defaultDefinition.getTransition());
227227
assertEquals("RejectApplication", defaultDefinition.getTransition().getNextState());
228-
assertNotNull(defaultDefinition.getTransition().getProduceEvents());
229-
assertTrue(defaultDefinition.getTransition().getProduceEvents().isEmpty());
228+
assertNull(defaultDefinition.getTransition().getProduceEvents());
230229
assertTrue(defaultDefinition.getTransition().isCompensate());
231230
}
232231

0 commit comments

Comments
 (0)