Skip to content

Commit de4ed57

Browse files
authored
Release/10.0.1 (#61)
* Release/10.0.1
1 parent 51330dc commit de4ed57

20 files changed

Lines changed: 745 additions & 668 deletions

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
66

77
## [Unreleased]
88

9+
## [10.0.1] - 2025-05-16
10+
11+
### Fixed:
12+
- We fixed an issue that caused unit test microflows with auto-committed objects to fail with an unhandled exception (#244962, #246277, #246384).
13+
- We fixed reporting issue for ThrowAssetionFailed action. Now a failed unnamed assertion step will be reported.
14+
915
## [10.0.0] - 2025-04-24
1016

1117
### Added:

dist/UnitTesting_10.0.1.mpk

3.3 MB
Binary file not shown.

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>com.mendix.UnitTesting</groupId>
88
<artifactId>UnitTesting</artifactId>
9-
<version>10.0.0</version>
9+
<version>10.0.1</version>
1010

1111
<repositories>
1212
<repository>

src/UnitTesting.mpr

-288 KB
Binary file not shown.
Lines changed: 57 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,57 @@
1-
// This file was generated by Mendix Studio Pro.
2-
//
3-
// WARNING: Only the following code will be retained when actions are regenerated:
4-
// - the import list
5-
// - the code between BEGIN USER CODE and END USER CODE
6-
// - the code between BEGIN EXTRA CODE and END EXTRA CODE
7-
// Other code you write will be lost the next time you deploy the project.
8-
// Special characters, e.g., é, ö, à, etc. are supported in comments.
9-
10-
package system.actions;
11-
12-
import com.mendix.core.Core;
13-
import com.mendix.systemwideinterfaces.core.IUser;
14-
import com.mendix.systemwideinterfaces.core.IContext;
15-
import com.mendix.systemwideinterfaces.core.UserAction;
16-
17-
/**
18-
* Verifies that the specified user name/password combination is valid.
19-
*/
20-
public class VerifyPassword extends UserAction<java.lang.Boolean>
21-
{
22-
private final java.lang.String userName;
23-
private final java.lang.String password;
24-
25-
public VerifyPassword(
26-
IContext context,
27-
java.lang.String _userName,
28-
java.lang.String _password
29-
)
30-
{
31-
super(context);
32-
this.userName = _userName;
33-
this.password = _password;
34-
}
35-
36-
@java.lang.Override
37-
public java.lang.Boolean executeAction() throws Exception
38-
{
39-
// BEGIN USER CODE
40-
IUser user = Core.getUser(getContext(), userName);
41-
return user != null && Core.authenticate(getContext(), user, password);
42-
// END USER CODE
43-
}
44-
45-
/**
46-
* Returns a string representation of this action
47-
* @return a string representation of this action
48-
*/
49-
@java.lang.Override
50-
public java.lang.String toString()
51-
{
52-
return "VerifyPassword";
53-
}
54-
55-
// BEGIN EXTRA CODE
56-
// END EXTRA CODE
57-
}
1+
// This file was generated by Mendix Studio Pro.
2+
//
3+
// WARNING: Only the following code will be retained when actions are regenerated:
4+
// - the import list
5+
// - the code between BEGIN USER CODE and END USER CODE
6+
// - the code between BEGIN EXTRA CODE and END EXTRA CODE
7+
// Other code you write will be lost the next time you deploy the project.
8+
// Special characters, e.g., é, ö, à, etc. are supported in comments.
9+
10+
package system.actions;
11+
12+
import com.mendix.core.Core;
13+
import com.mendix.systemwideinterfaces.core.IUser;
14+
import com.mendix.systemwideinterfaces.core.IContext;
15+
import com.mendix.systemwideinterfaces.core.UserAction;
16+
17+
/**
18+
* Verifies that the specified user name/password combination is valid.
19+
*/
20+
public class VerifyPassword extends UserAction<java.lang.Boolean>
21+
{
22+
private final java.lang.String userName;
23+
private final java.lang.String password;
24+
25+
public VerifyPassword(
26+
IContext context,
27+
java.lang.String _userName,
28+
java.lang.String _password
29+
)
30+
{
31+
super(context);
32+
this.userName = _userName;
33+
this.password = _password;
34+
}
35+
36+
@java.lang.Override
37+
public java.lang.Boolean executeAction() throws Exception
38+
{
39+
// BEGIN USER CODE
40+
IUser user = Core.getUser(getContext(), userName);
41+
return user != null && Core.authenticate(getContext(), user, password);
42+
// END USER CODE
43+
}
44+
45+
/**
46+
* Returns a string representation of this action
47+
* @return a string representation of this action
48+
*/
49+
@java.lang.Override
50+
public java.lang.String toString()
51+
{
52+
return "VerifyPassword";
53+
}
54+
55+
// BEGIN EXTRA CODE
56+
// END EXTRA CODE
57+
}
Lines changed: 43 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,64 @@
11
package testjavaimplementation;
22

33
import com.mendix.core.Core;
4-
import com.mendix.systemwideinterfaces.core.IContext;
54
import org.junit.After;
65
import org.junit.Before;
76
import org.junit.Test;
87
import unittesting.TestExecutionContext;
8+
import unittesting.activities.AssertActivity;
99

1010
import static org.junit.Assert.*;
1111

1212
public class TestExecutionContextTest {
13-
private final IContext context = Core.createSystemContext();
13+
private static final String FAILURE_MESSAGE = "This is a failure message";
1414
private TestExecutionContext testExecutionContext;
1515

1616
@Before
1717
public void setup() {
18-
this.testExecutionContext = new TestExecutionContext(context, "ExampleMicroflow");
18+
this.testExecutionContext = new TestExecutionContext();
1919
}
2020

2121
@After
2222
public void tearDown() {
23-
this.testExecutionContext.delete();
2423
this.testExecutionContext = null;
2524
}
2625

27-
@Test
28-
public void testExecutionContextShouldInitializeUnitTestContext() {
29-
assertNotNull(this.testExecutionContext.getUnitTestContext());
30-
}
31-
3226
@Test
3327
public void hasFailedAssertionShouldBeFalseByDefault() {
34-
assertFalse(this.testExecutionContext.hasFailedAssertion(context));
28+
assertFalse(this.testExecutionContext.hasFailedAssertion());
3529
}
3630

3731
@Test
3832
public void hasFailedAssertionShouldBeFalseWhenAllAssertionsPassed() {
39-
this.testExecutionContext.collectAssertion(context, "Passed 1", true, null);
40-
this.testExecutionContext.collectAssertion(context, "Passed 2", true, null);
33+
this.testExecutionContext.collectAssertion("Passed 1", true, null);
34+
this.testExecutionContext.collectAssertion("Passed 2", true, null);
4135

42-
assertFalse(this.testExecutionContext.hasFailedAssertion(context));
36+
assertFalse(this.testExecutionContext.hasFailedAssertion());
4337
}
4438

4539
@Test
4640
public void hasFailedAssertionShouldBeTrueWhenCollectingFailedAssertion() {
47-
this.testExecutionContext.collectAssertion(context, "Passed", true, null);
48-
this.testExecutionContext.collectAssertion(context, "Failed", false, null);
41+
this.testExecutionContext.collectAssertion("Passed", true, null);
42+
this.testExecutionContext.collectAssertion("Failed", false, null);
43+
44+
assertTrue(this.testExecutionContext.hasFailedAssertion());
45+
}
46+
47+
@Test
48+
public void assertActivityShouldContainFailureMessageWhenCollectingFailedAssertion() {
49+
AssertActivity assertion = this.testExecutionContext.collectAssertion("Failed", false, FAILURE_MESSAGE);
50+
51+
assertEquals(FAILURE_MESSAGE, assertion.getMessage());
52+
}
4953

50-
assertTrue(this.testExecutionContext.hasFailedAssertion(context));
54+
@Test
55+
public void assertActivityShouldNotContainFailureMessageWhenCollectingPassedAssertion() {
56+
AssertActivity assertion = this.testExecutionContext.collectAssertion("Passed", true, FAILURE_MESSAGE);
57+
58+
assertNull(assertion.getMessage());
5159
}
5260

61+
5362
@Test
5463
public void getLastStepShouldBeNullByDefault() {
5564
assertNull(this.testExecutionContext.getLastStep());
@@ -65,67 +74,67 @@ public void getLastStepShouldReturnLastCollectedStep() {
6574

6675
@Test
6776
public void getFailureReasonsShouldBeNullByDefault() {
68-
assertEquals(0, this.testExecutionContext.getFailureReasons(context).size());
77+
assertEquals(0, this.testExecutionContext.getFailureReasons().size());
6978
}
7079

7180
@Test
7281
public void getFailureReasonsShouldBeNullIfTestPassed() {
7382
this.testExecutionContext.collectStart(true, null);
74-
this.testExecutionContext.collectAssertion(context, "Passed 1", true, null);
75-
this.testExecutionContext.collectAssertion(context, "Passed 2", true, null);
83+
this.testExecutionContext.collectAssertion("Passed 1", true, null);
84+
this.testExecutionContext.collectAssertion("Passed 2", true, null);
7685
this.testExecutionContext.collectEnd(true, null);
7786

78-
assertEquals(0, this.testExecutionContext.getFailureReasons(context).size());
87+
assertEquals(0, this.testExecutionContext.getFailureReasons().size());
7988
}
8089

8190
@Test
8291
public void getFailureReasonsShouldIncludeFailedStart() {
8392
this.testExecutionContext.collectStart(false, "Start failed");
8493

85-
assertEquals(1, this.testExecutionContext.getFailureReasons(context).size());
94+
assertEquals(1, this.testExecutionContext.getFailureReasons().size());
8695
}
8796

8897
@Test
8998
public void getFailureReasonsShouldIncludeFailedEnd() {
9099
this.testExecutionContext.collectEnd(false, "End failed");
91100

92-
assertEquals(1, this.testExecutionContext.getFailureReasons(context).size());
101+
assertEquals(1, this.testExecutionContext.getFailureReasons().size());
93102
}
94103

95104
@Test
96105
public void getFailureReasonsShouldIncludeFailedAssertion() {
97-
this.testExecutionContext.collectAssertion(context, "Passed", true, null);
98-
this.testExecutionContext.collectAssertion(context, "Failed 1", false, null);
99-
this.testExecutionContext.collectAssertion(context, "Failed 2", false, null);
106+
this.testExecutionContext.collectAssertion("Passed", true, null);
107+
this.testExecutionContext.collectAssertion("Failed 1", false, null);
108+
this.testExecutionContext.collectAssertion("Failed 2", false, null);
100109

101-
assertEquals(1, this.testExecutionContext.getFailureReasons(context).size());
110+
assertEquals(1, this.testExecutionContext.getFailureReasons().size());
102111
}
103112

104113
@Test
105114
public void getFailureReasonsShouldIncludeUncaughtException() {
106115
this.testExecutionContext.collectException(new Exception("Example Exception"));
107116

108-
assertEquals(1, this.testExecutionContext.getFailureReasons(context).size());
117+
assertEquals(1, this.testExecutionContext.getFailureReasons().size());
109118
}
110119

111120
@Test
112121
public void getFailureReasonsShouldIncludeAllUniqueFailureReasons() {
113122
this.testExecutionContext.collectStart(false, "Start failed");
114-
this.testExecutionContext.collectAssertion(context, "Failed 1", false, null);
115-
this.testExecutionContext.collectAssertion(context, "Failed 2", false, null);
123+
this.testExecutionContext.collectAssertion("Failed 1", false, null);
124+
this.testExecutionContext.collectAssertion("Failed 2", false, null);
116125
this.testExecutionContext.collectException(new Exception("Test Exception"));
117126
this.testExecutionContext.collectEnd(false, "End failed");
118127

119-
assertEquals(4, this.testExecutionContext.getFailureReasons(context).size());
128+
assertEquals(4, this.testExecutionContext.getFailureReasons().size());
120129
}
121130

122131
@Test
123132
public void createTestActivitiesShouldContainAllCollectedTestActivities() {
124133
this.testExecutionContext.collectStart(true, "Started test");
125134

126-
this.testExecutionContext.collectAssertion(context, "Passed", true, null);
127-
this.testExecutionContext.collectAssertion(context, "Failed 1", false, null);
128-
this.testExecutionContext.collectAssertion(context, "Failed 2", false, null);
135+
this.testExecutionContext.collectAssertion("Passed", true, null);
136+
this.testExecutionContext.collectAssertion("Failed 1", false, null);
137+
this.testExecutionContext.collectAssertion("Failed 2", false, null);
129138

130139
this.testExecutionContext.collectStep("Step 1");
131140
this.testExecutionContext.collectStep("Step 2");
@@ -134,6 +143,6 @@ public void createTestActivitiesShouldContainAllCollectedTestActivities() {
134143

135144
this.testExecutionContext.collectEnd(true, "Test ended successfully");
136145

137-
assertEquals(8, this.testExecutionContext.createTestActivities(context, null).size());
146+
assertEquals(8, this.testExecutionContext.createTestActivities(Core.createSystemContext(), null).size());
138147
}
139148
}

0 commit comments

Comments
 (0)