Search in sources :

Example 6 with ReviewDecision

use of org.olat.modules.qpool.model.ReviewDecision in project openolat by klemens.

the class QuestionPoolServiceImplTest method shouldSetNewStatusIfChanged.

@Test
public void shouldSetNewStatusIfChanged() {
    Float rating = new Float(RATING_FIVE);
    QuestionStatus status = QuestionStatus.finalVersion;
    ReviewDecision decision = new ReviewDecision(true, status);
    when(reviewServiceMock.decideStatus(item, rating)).thenReturn(decision);
    sut.rateItemInReview(item, identityDummy, rating, null);
    assertThat(item.getQuestionStatus()).isEqualTo(status);
}
Also used : ReviewDecision(org.olat.modules.qpool.model.ReviewDecision) QuestionStatus(org.olat.modules.qpool.QuestionStatus) Test(org.junit.Test)

Example 7 with ReviewDecision

use of org.olat.modules.qpool.model.ReviewDecision in project openolat by klemens.

the class LowerLimitProviderTest method shouldSetFinalIfEnoughRatings.

@Test
public void shouldSetFinalIfEnoughRatings() {
    when(commentAndRatingServiceMock.countRatings(any(), any())).thenReturn(RATINGS_OK);
    ReviewDecision decision = sut.decideStatus(item, RATING_OK);
    assertThat(decision.isStatusChanged()).isTrue();
    assertThat(decision.getStatus()).isEqualTo(QuestionStatus.finalVersion);
}
Also used : ReviewDecision(org.olat.modules.qpool.model.ReviewDecision) Test(org.junit.Test)

Example 8 with ReviewDecision

use of org.olat.modules.qpool.model.ReviewDecision in project OpenOLAT by OpenOLAT.

the class LowerLimitProviderTest method shouldSetRevisedIfRatingToLow.

@Test
public void shouldSetRevisedIfRatingToLow() {
    ReviewDecision decision = sut.decideStatus(item, RATING_TO_LOW);
    assertThat(decision.isStatusChanged()).isTrue();
    assertThat(decision.getStatus()).isEqualTo(QuestionStatus.revised);
}
Also used : ReviewDecision(org.olat.modules.qpool.model.ReviewDecision) Test(org.junit.Test)

Example 9 with ReviewDecision

use of org.olat.modules.qpool.model.ReviewDecision in project OpenOLAT by OpenOLAT.

the class LowerLimitProviderTest method shouldSetFinalIfEnoughRatings.

@Test
public void shouldSetFinalIfEnoughRatings() {
    when(commentAndRatingServiceMock.countRatings(any(), any())).thenReturn(RATINGS_OK);
    ReviewDecision decision = sut.decideStatus(item, RATING_OK);
    assertThat(decision.isStatusChanged()).isTrue();
    assertThat(decision.getStatus()).isEqualTo(QuestionStatus.finalVersion);
}
Also used : ReviewDecision(org.olat.modules.qpool.model.ReviewDecision) Test(org.junit.Test)

Example 10 with ReviewDecision

use of org.olat.modules.qpool.model.ReviewDecision in project OpenOLAT by OpenOLAT.

the class LowerLimitProviderTest method shouldNotChangeStatusIfNotEnoughRatings.

@Test
public void shouldNotChangeStatusIfNotEnoughRatings() {
    when(commentAndRatingServiceMock.countRatings(any(), any())).thenReturn(RATINGS_TOO_LITTLE);
    ReviewDecision decision = sut.decideStatus(item, RATING_OK);
    assertThat(decision.isStatusChanged()).isFalse();
    assertThat(decision.getStatus()).isEqualTo(item.getQuestionStatus());
}
Also used : ReviewDecision(org.olat.modules.qpool.model.ReviewDecision) Test(org.junit.Test)

Aggregations

ReviewDecision (org.olat.modules.qpool.model.ReviewDecision)14 Test (org.junit.Test)12 QuestionStatus (org.olat.modules.qpool.QuestionStatus)4 QuestionItem (org.olat.modules.qpool.QuestionItem)2 QuestionItemAuditLogBuilder (org.olat.modules.qpool.QuestionItemAuditLogBuilder)2 QuestionItemImpl (org.olat.modules.qpool.model.QuestionItemImpl)2