@@ -519,7 +519,7 @@ public void missingTargetErrorsIfRatingElementPresent() throws Exception {
519519
520520 @ Test
521521 public void invalidRatingValueReturnsError () throws Exception {
522-
522+
523523 Element entry = (Element ) this .ratingEntry .clone ();
524524 entry .element ("target" ).element ("id" ).setText ("1" );
525525 entry .element ("rating" ).setText ("awesome" );
@@ -532,7 +532,7 @@ public void invalidRatingValueReturnsError() throws Exception {
532532
533533 @ Test
534534 public void outOfRangeRatingReturnsError () throws Exception {
535-
535+
536536 Element entry = (Element ) this .ratingEntry .clone ();
537537 entry .element ("rating" ).setText ("6.0" );
538538 entry .element ("target" ).element ("id" ).setText ("1" );
@@ -542,7 +542,7 @@ public void outOfRangeRatingReturnsError() throws Exception {
542542 Assert .assertEquals (ValidateEntry .RATING_OUT_OF_RANGE ,
543543 validateEntry .getErrorMessage ());
544544 }
545-
545+
546546 @ Test
547547 public void nonWholeNumberRatingReturnsError () throws Exception {
548548 Element entry = (Element ) this .ratingEntry .clone ();
@@ -554,82 +554,87 @@ public void nonWholeNumberRatingReturnsError() throws Exception {
554554 Assert .assertEquals (ValidateEntry .INVALID_RATING_VALUE ,
555555 validateEntry .getErrorMessage ());
556556 }
557-
558- @ Test
559- public void ratingElementGetsAddedToPayloadAsExpected () throws Exception {
560-
561- String rating = "4" ;
562-
557+
558+ @ Test
559+ public void ratingElementGetsAddedToPayloadAsExpected () throws Exception {
560+
561+ String rating = "4" ;
562+
563563 Element entry = (Element ) this .ratingEntry .clone ();
564564 entry .element ("rating" ).setText (rating );
565565 entry .element ("target" ).element ("id" ).setText ("1" );
566566 validateEntry = getEntryObject (entry );
567-
567+
568568 Assert .assertTrue (validateEntry .isValid ());
569569 Element payload = validateEntry .getPayload ();
570-
571- Assert .assertEquals (ValidateEntry .NS_REVIEW , payload .getNamespaceForPrefix ("review" ).getText ());
572- Assert .assertEquals (rating + ".0" , payload .element ("rating" ).getTextTrim ());
573- }
574-
575- @ Test
576- public void postTitleIsSetToRatingWhenRated () throws Exception {
570+
571+ Assert .assertEquals (ValidateEntry .NS_REVIEW , payload
572+ .getNamespaceForPrefix ("review" ).getText ());
573+ Assert .assertEquals (rating + ".0" , payload .element ("rating" )
574+ .getTextTrim ());
575+ }
576+
577+ @ Test
578+ public void postTitleIsSetToRatingWhenRated () throws Exception {
577579
578580 Element entry = (Element ) this .ratingEntry .clone ();
579581 entry .element ("target" ).element ("id" ).setText ("1" );
580582 validateEntry = getEntryObject (entry );
581-
583+
582584 Assert .assertTrue (validateEntry .isValid ());
583585 Element payload = validateEntry .getPayload ();
584-
585- Assert .assertEquals (ValidateEntry .NS_REVIEW , payload .getNamespaceForPrefix ("review" ).getText ());
586+
587+ Assert .assertEquals (ValidateEntry .NS_REVIEW , payload
588+ .getNamespaceForPrefix ("review" ).getText ());
586589 Assert .assertEquals ("Rating" , payload .elementText ("title" ));
587- }
588-
589- @ Test
590- public void postVerbGetsSwitchedToRated () throws Exception {
590+ }
591+
592+ @ Test
593+ public void postVerbGetsSwitchedToRated () throws Exception {
591594 Element entry = (Element ) this .ratingEntry .clone ();
592595 entry .element ("target" ).element ("id" ).setText ("1" );
593596 validateEntry = getEntryObject (entry );
594-
597+
595598 Assert .assertTrue (validateEntry .isValid ());
596599 Element payload = validateEntry .getPayload ();
597-
598- Assert .assertEquals (ValidateEntry .ACTIVITY_VERB_RATED , payload .elementText ("verb" ));
599- }
600-
601- @ Test
602- public void postContentGetsReplacedWithRating () throws Exception {
600+
601+ Assert .assertEquals (ValidateEntry .ACTIVITY_VERB_RATED ,
602+ payload .elementText ("verb" ));
603+ }
604+
605+ @ Test
606+ public void postContentGetsReplacedWithRating () throws Exception {
603607 Element entry = (Element ) this .ratingEntry .clone ();
604608 entry .element ("target" ).element ("id" ).setText ("1" );
605-
609+
606610 String expectedContent = "rating:5.0" ;
607611 Assert .assertFalse (entry .elementText ("content" ).equals (expectedContent ));
608-
612+
609613 validateEntry = getEntryObject (entry );
610-
614+
611615 Assert .assertTrue (validateEntry .isValid ());
612616 Element payload = validateEntry .getPayload ();
613617
614618 Assert .assertEquals (expectedContent , payload .elementText ("content" ));
615- }
616-
617- @ Test
618- public void canNotRateARating () throws Exception {
619- String testPayload = "<entry xmlns=\" http://www.w3.org/2005/Atom\" " +
620- "xmlns:review=\" http://activitystrea.ms/schema/1.0/review\" >" +
621- "<review:rating>5.0</review:rating></entry>" ;
619+ }
620+
621+ @ Test
622+ public void canNotRateARating () throws Exception {
623+ String testPayload = "<entry xmlns=\" http://www.w3.org/2005/Atom\" "
624+ + "xmlns:review=\" http://activitystrea.ms/schema/1.0/review\" >"
625+ + "<review:rating>5.0</review:rating></entry>" ;
622626 NodeItem item = new NodeItemImpl (node , "1" , new Date (), testPayload );
623627 Mockito .when (
624628 channelManager .getNodeItem (Mockito .eq (node ),
625629 Mockito .anyString ())).thenReturn (item );
626-
627- Element entry = (Element ) this .ratingEntry .clone ();
630+
631+ Element entry = (Element ) this .ratingEntry .clone ();
628632 entry .element ("target" ).element ("id" ).setText ("1" );
629633 validateEntry = getEntryObject (entry );
630-
634+
631635 Assert .assertFalse (validateEntry .isValid ());
632- Assert .assertEquals (ValidateEntry .CAN_ONLY_RATE_A_POST , validateEntry .getErrorMessage ());
633- }
636+ Assert .assertEquals (ValidateEntry .CAN_ONLY_RATE_A_POST ,
637+ validateEntry .getErrorMessage ());
638+ }
634639
635640}
0 commit comments