1717import com .marklogic .client .DatabaseClient ;
1818import com .marklogic .client .DatabaseClientFactory ;
1919import com .marklogic .client .DatabaseClientFactory .Authentication ;
20+ import com .marklogic .client .ResourceNotFoundException ;
2021import com .marklogic .client .pojo .PojoPage ;
2122import com .marklogic .client .pojo .PojoRepository ;
2223import 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
@@ -469,17 +471,18 @@ public void testPOJORepoDeleteWithNegativeId() {
469471 // Delete the object
470472 pojoReposProducts .delete (longId );
471473
472- // Validate the artifact read back.
474+ // Validate the artifact read back. ResourceNotFoundException will be thrown.
475+ @ SuppressWarnings ("unused" )
473476 Artifact artifact = pojoReposProducts .read (longId );
474- assertNull (artifact );
475477 }
476478
477479 /*
478480 * Purpose : This test is to validate delete documents using delete(ID....)
479481 * POJO instance @Id field value with Negative numbers.
482+ * Expect ResourceNotFoundException when there are no URI found. As per Git # 188.
480483 */
481484
482- @ Test
485+ @ Test ( expected = ResourceNotFoundException . class )
483486 public void testPOJORepoDeleteWithNegativeIdArray () {
484487 long longId1 = getOneNegativeLongId ();
485488 long longId2 = getOneNegativeLongId ();
@@ -502,8 +505,7 @@ public void testPOJORepoDeleteWithNegativeIdArray() {
502505 pojoReposProducts .delete (longId1 ,longId2 );
503506
504507 // Validate the artifacts read back is zero.
505- pojoArtifactPage = pojoReposProducts .read (pojoReposProductsIdLongArray );
506- assertEquals ("Total number of object records" , 0 , pojoArtifactPage .getPageSize ());
508+ pojoArtifactPage = pojoReposProducts .read (pojoReposProductsIdLongArray );
507509 }
508510
509511 /*
@@ -534,22 +536,18 @@ public void testPOJORepoReadWithNegativeIdArray() {
534536
535537 System .out .println ("The number of pages covering all possible items " + pojoArtifactPage .getTotalPages ());
536538 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.
539+
539540 System .out .println ("The page number within the count of all possible pages " + pojoArtifactPage .getPageNumber ());
540541 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.
542+
543543 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.
544+ assertEquals ("The page size which is the maximum number of items allowed in one page " , 2 , pojoArtifactPage .getPageSize ());
545+
547546 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());
547+ assertEquals ("The start position of this page within all possible items " , 1 , pojoArtifactPage .getStart ());
549548
550- //Not sure about this feature. O/P is -1 now.
551549 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());
550+ assertEquals ("The total count (potentially an estimate) of all possible items in the set " , 2 , pojoArtifactPage .getTotalSize ());
553551
554552 Iterator <Artifact > itr = pojoArtifactPage .iterator ();
555553 Artifact artifact = null ;
0 commit comments