Skip to content

Commit a6d75ae

Browse files
Ajit GeorgeAjit George
authored andcommitted
Fixed tests. refer to Git issue #188.
1 parent b88e14e commit a6d75ae

File tree

1 file changed

+15
-18
lines changed

1 file changed

+15
-18
lines changed

test-complete/src/test/java/com/marklogic/javaclient/TestPOJOSpecialCharRead.java

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import com.marklogic.client.DatabaseClient;
1818
import com.marklogic.client.DatabaseClientFactory;
1919
import com.marklogic.client.DatabaseClientFactory.Authentication;
20+
import com.marklogic.client.ResourceNotFoundException;
2021
import com.marklogic.client.pojo.PojoPage;
2122
import com.marklogic.client.pojo.PojoRepository;
2223
import com.marklogic.client.pojo.annotation.Id;
@@ -391,10 +392,10 @@ public void validateArtifactTwo(Artifact artifact, long longId) {
391392
assertNotNull("Artifact object should never be Null", artifact);
392393
assertNotNull("Id should never be Null",artifact.id);
393394
assertEquals("Id of the object is ",longId, artifact.getId());
394-
assertEquals("Name of the object is ","Cogs -2000", artifact.getName());
395+
assertEquals("Name of the object is ","Cogs", artifact.getName());
395396
assertEquals("Inventory of the object is ",1000, artifact.getInventory());
396-
assertEquals("Company name of the object is ","Acme -2000, Inc.", artifact.getManufacturer().getName());
397-
assertEquals("Web site of the object is ","http://www.acme-2000.com", artifact.getManufacturer().getWebsite());
397+
assertEquals("Company name of the object is ","Acme Inc.", artifact.getManufacturer().getName());
398+
assertEquals("Web site of the object is ","http://www.acme.com", artifact.getManufacturer().getWebsite());
398399
assertEquals(-87.966, artifact.getManufacturer().getLongitude(), 0.00);
399400
assertEquals(41.998, artifact.getManufacturer().getLatitude(), 0.00);
400401
}
@@ -456,9 +457,10 @@ public void testPOJORepoReadWithNegativeId() {
456457
/*
457458
* Purpose : This test is to validate delete documents using delete(Id)
458459
* POJO instance @Id field value with Negative numbers.
460+
* Expect ResourceNotFoundException when there are no URI found. As per Git # 188.
459461
*/
460462

461-
@Test
463+
@Test(expected=ResourceNotFoundException.class)
462464
public void testPOJORepoDeleteWithNegativeId() {
463465
PojoRepository<Artifact,Long> pojoReposProducts = client.newPojoRepository(Artifact.class, Long.class);
464466

@@ -471,15 +473,15 @@ public void testPOJORepoDeleteWithNegativeId() {
471473

472474
// Validate the artifact read back.
473475
Artifact artifact = pojoReposProducts.read(longId);
474-
assertNull(artifact);
475476
}
476477

477478
/*
478479
* Purpose : This test is to validate delete documents using delete(ID....)
479480
* POJO instance @Id field value with Negative numbers.
481+
* Expect ResourceNotFoundException when there are no URI found. As per Git # 188.
480482
*/
481483

482-
@Test
484+
@Test(expected=ResourceNotFoundException.class)
483485
public void testPOJORepoDeleteWithNegativeIdArray() {
484486
long longId1 = getOneNegativeLongId();
485487
long longId2 = getOneNegativeLongId();
@@ -502,8 +504,7 @@ public void testPOJORepoDeleteWithNegativeIdArray() {
502504
pojoReposProducts.delete(longId1,longId2);
503505

504506
// Validate the artifacts read back is zero.
505-
pojoArtifactPage = pojoReposProducts.read(pojoReposProductsIdLongArray);
506-
assertEquals("Total number of object records", 0, pojoArtifactPage.getPageSize());
507+
pojoArtifactPage = pojoReposProducts.read(pojoReposProductsIdLongArray);
507508
}
508509

509510
/*
@@ -534,22 +535,18 @@ public void testPOJORepoReadWithNegativeIdArray() {
534535

535536
System.out.println("The number of pages covering all possible items "+ pojoArtifactPage.getTotalPages());
536537
assertEquals("The number of pages covering all possible items ", 1, pojoArtifactPage.getTotalPages());
537-
538-
// Not sure about this feature. Should page number at the last or at the start. O/P is 2 now.
538+
539539
System.out.println("The page number within the count of all possible pages "+ pojoArtifactPage.getPageNumber());
540540
assertEquals("The page number within the count of all possible pages ", 1, pojoArtifactPage.getPageNumber());
541-
542-
// Not sure about this feature. User cannot set the max # of items allowed in one page. O/P is -1 now.
541+
543542
System.out.println("The page size which is the maximum number of items allowed in one page "+ pojoArtifactPage.getPageSize());
544-
//assertEquals("The page size which is the maximum number of items allowed in one page ", 1, pojoArtifactPage.getPageSize());
545-
546-
//Not sure about this feature. Start position of this page within all possible items. O/P is -1 now.
543+
assertEquals("The page size which is the maximum number of items allowed in one page ", 2, pojoArtifactPage.getPageSize());
544+
547545
System.out.println("The start position of this page within all possible items "+ pojoArtifactPage.getStart());
548-
//assertEquals("The start position of this page within all possible items ", 1, pojoArtifactPage.getStart());
546+
assertEquals("The start position of this page within all possible items ", 1, pojoArtifactPage.getStart());
549547

550-
//Not sure about this feature. O/P is -1 now.
551548
System.out.println("The total count (potentially an estimate) of all possible items in the set "+ pojoArtifactPage.getTotalSize());
552-
//assertEquals("The total count (potentially an estimate) of all possible items in the set ", 1, pojoArtifactPage.getTotalSize());
549+
assertEquals("The total count (potentially an estimate) of all possible items in the set ", 2, pojoArtifactPage.getTotalSize());
553550

554551
Iterator<Artifact> itr = pojoArtifactPage.iterator();
555552
Artifact artifact = null;

0 commit comments

Comments
 (0)