Skip to content

Commit 2dfdcd2

Browse files
Ajit GeorgeAjit George
authored andcommitted
Tests updated to verify getId on repository - #456
1 parent 78a6f0d commit 2dfdcd2

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

test-complete/src/test/java/com/marklogic/client/functionaltest/TestPOJOBasicSearch.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ public void testPOJOSearchWithCollections() {
108108
while(p.iterator().hasNext()){
109109
Artifact a =p.iterator().next();
110110
validateArtifact(a);
111+
assertEquals("Repository getId value incorrect", a.getId(), products.getId(a).longValue());
111112
assertTrue("Artifact Id is even", a.getId()%2==0);
112113
count++;
113114
}
@@ -122,6 +123,7 @@ public void testPOJOSearchWithCollections() {
122123
while(p.iterator().hasNext()){
123124
Artifact a =p.iterator().next();
124125
assertTrue("Artifact Id is even", a.getId()%2 !=0);
126+
assertEquals("Repository getId value incorrect", a.getId(), products.getId(a).longValue());
125127
validateArtifact(a);
126128
products.delete(a.getId());
127129
count++;

test-complete/src/test/java/com/marklogic/client/functionaltest/TestPOJOWithDocsStoredByOthers.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@
1616

1717
package com.marklogic.client.functionaltest;
1818

19-
import static org.junit.Assert.assertEquals;
20-
import static org.junit.Assert.assertNotNull;
19+
import static org.junit.Assert.*;
2120

2221
import java.util.Calendar;
2322

@@ -498,6 +497,7 @@ public void testPOJOWriteReadSuper() throws Exception {
498497
pojoReposSmallArtifact.write(art,"com.marklogic.client.functionaltest.TestPOJOMissingIdGetSetMethod$SmallArtifactSuper/SmallArtifactSuper.json");
499498

500499
SmallArtifactNoId artifact1 = pojoReposSmallArtifact.read(artifactName);
500+
assertTrue("GetId for String incorrect", "SmallArtifactInSuperOnly".equalsIgnoreCase(pojoReposSmallArtifact.getId(artifact1)));
501501
validateSmallArtifactSuper(artifact1);
502502
}
503503

@@ -520,11 +520,12 @@ public void testPOJOWriteReadSuperAndSub() throws Exception {
520520
art.setInventory(1000);
521521
art.setName(artifactName);
522522
art.setOriginCountry("USA");
523-
523+
524524
// Load the object into database
525525
pojoReposSmallArtifact.write(art,"com.marklogic.client.functionaltest.TestPOJOMissingIdGetSetMethod$SmallArtifactSuper/SmallArtifactSuper.json");
526526

527527
SmallArtifactIdInSuperAndSub artifact1 = pojoReposSmallArtifact.read(artifactName);
528+
assertEquals("Repository getId value incorrect", artifact1.getName(), pojoReposSmallArtifact.getId(artifact1).toString());
528529
validateSmallArtifactSuperAndSub(artifact1);
529530
}
530531

0 commit comments

Comments
 (0)