Skip to content

Commit

Permalink
Fix tests due to DataNucleus behavior change
Browse files Browse the repository at this point in the history
This was also done for DT v4.11.0: DependencyTrack/dependency-track#3515

Signed-off-by: nscuro <nscuro@protonmail.com>
  • Loading branch information
nscuro committed Mar 20, 2024
1 parent 05e2560 commit d09159a
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,8 @@ public void addTeamToRuleWithCustomEmailPublisherTest() {
"teams": [
{
"uuid": "${json-unit.matches:teamUuid}",
"name": "Team Example"
"name": "Team Example",
"permissions": []
}
],
"notifyOn": [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
import org.glassfish.jersey.servlet.ServletContainer;
import org.glassfish.jersey.test.DeploymentContext;
import org.glassfish.jersey.test.ServletDeploymentContext;
import org.hamcrest.CoreMatchers;
import org.junit.After;
import org.junit.Assert;
import org.junit.Test;
Expand Down Expand Up @@ -639,9 +640,24 @@ public void patchProjectParentTest() {

assertThat(response.getStatus()).isEqualTo(Response.Status.OK.getStatusCode());

final JsonObject responseJson = parseJsonObject(response);
assertThat(responseJson.getString("uuid")).isEqualTo(project.getUuid().toString());
assertThat(responseJson.getJsonObject("parent")).isNull(); // Parents are currently not returned
assertThatJson(getPlainTextBody(response))
.withMatcher("projectUuid", CoreMatchers.equalTo(project.getUuid().toString()))
.withMatcher("parentProjectUuid", CoreMatchers.equalTo(newParent.getUuid().toString()))
.isEqualTo("""
{
"name": "DEF",
"version": "2.0",
"uuid": "${json-unit.matches:projectUuid}",
"parent": {
"name": "GHI",
"version": "3.0",
"uuid": "${json-unit.matches:parentProjectUuid}"
},
"properties": [],
"tags": [],
"active": true
}
""");

// Ensure the parent was updated.
qm.getPersistenceManager().refresh(project);
Expand Down

0 comments on commit d09159a

Please sign in to comment.