Skip to content

Commit

Permalink
broke out rating into separate project
Browse files Browse the repository at this point in the history
  • Loading branch information
unknown authored and unknown committed Aug 12, 2012
1 parent 996d332 commit 00960b3
Show file tree
Hide file tree
Showing 10 changed files with 8 additions and 194 deletions.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

@@ -1,14 +1,11 @@
package com.visionarysoftwaresolutions.reviewable;

import com.visionarysoftwaresolutions.reviewable.rating.Rater;
import com.visionarysoftwaresolutions.reviewable.rating.RatingScale;
import com.visionarysoftwaresolutions.reviewable.rating.RatedReview;
import com.visionarysoftwaresolutions.reviewable.stubs.*;
import org.junit.Test;
import static org.junit.Assert.*;

public class ReviewableTest {
Rater nick = new User("nick");
Reviewer nick = new User("nick");
Reviewable food = new Food("Phonecian Cafe Hummus");

@Test
Expand All @@ -22,29 +19,14 @@ public void testReview() {
assertEquals(result.getDescription(), "It is so creamy and delicious!");
}

@Test
public void testRatedReview(){
//When I have the Reviewer rate the Reviewable
RatedReview result = nick.rate(food,
"It is so creamy and delicious!",
FiveStarRatingScale.five());
//Then it is rated
assertEquals(result.getReviewer(), nick);
assertEquals(result.getReviewed(), food);
RatingScale howRated = result.getRatingScale();
assertEquals(howRated.getRating(), new NumericalRating(5,howRated));
assertArrayEquals(howRated.range(),
new String[] { "0", "1", "2", "3", "4", "5" });
}

@Test
public void testDatedReview(){
//Given I'm reviewing something today
java.util.Date today = new java.util.Date();
//When I have a reviewer rate a reviewable
RatedReview result = nick.rate(food,
"It is so creamy and delicious!",
FiveStarRatingScale.five());
Review result = nick.review(food,
"It is so creamy and delicious!");
//And I want a Dated Review
DatedReview datedResult = new DatedReview(result);
//Then it is rated
Expand Down
@@ -1,13 +1,14 @@
package com.visionarysoftwaresolutions.reviewable.stubs;
import com.visionarysoftwaresolutions.reviewable.rating.RatedReview;

import com.visionarysoftwaresolutions.reviewable.Review;
import com.visionarysoftwaresolutions.reviewable.ReviewDecorator;
import java.util.Date;

public class DatedReview extends ReviewDecorator {

private Date date;

public DatedReview(RatedReview review){
public DatedReview(Review review){
super(review);
date = new java.util.Date();
}
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

@@ -1,12 +1,10 @@
package com.visionarysoftwaresolutions.reviewable.stubs;

import com.visionarysoftwaresolutions.reviewable.rating.RatedReview;
import com.visionarysoftwaresolutions.reviewable.rating.Rater;
import com.visionarysoftwaresolutions.reviewable.rating.RatingScale;
import com.visionarysoftwaresolutions.reviewable.Review;
import com.visionarysoftwaresolutions.reviewable.Reviewable;
import com.visionarysoftwaresolutions.reviewable.Reviewer;

public class User implements Rater {
public class User implements Reviewer {
private String name;

public User(String string) {
Expand All @@ -17,9 +15,4 @@ public User(String string) {
public Review review(Reviewable toReview, String description) {
return new BasicFoodReview(this, toReview, description);
}

@Override
public RatedReview rate(Reviewable toReview, String description, RatingScale scale) {
return new RatedFoodReview(this,toReview,description,scale);
}
}

0 comments on commit 00960b3

Please sign in to comment.