Search in sources :

Example 26 with Participation

use of de.tum.in.www1.artemis.domain.participation.Participation in project ArTEMiS by ls1intum.

the class GitServiceIntTest method testListFiles.

@Test
public void testListFiles() throws IOException, GitAPIException {
    Participation participation = new Participation();
    participation.setRepositoryUrl(remoteTestRepo);
    Repository repo = gitService.getOrCheckoutRepository(participation);
    Collection<de.tum.in.www1.artemis.domain.File> files = gitService.listFiles(repo);
    assertThat(files.size()).isGreaterThan(0);
    gitService.deleteLocalRepository(repo);
}
Also used : Participation(de.tum.in.www1.artemis.domain.Participation) Repository(de.tum.in.www1.artemis.domain.Repository) File(java.io.File) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 27 with Participation

use of de.tum.in.www1.artemis.domain.participation.Participation in project ArTEMiS by ls1intum.

the class LtiServiceIntTest method assertThatUnsuccessfulResultWithoutTextReturnsZeroScore.

@Test
public void assertThatUnsuccessfulResultWithoutTextReturnsZeroScore() {
    Participation participation = new Participation();
    participationRepository.save(participation);
    Result result = new Result();
    result.setParticipation(participation);
    result.setSuccessful(false);
    resultRepository.save(result);
    // String score = ltiService.getScoreForParticipation(participation);
    // assertThat(score).isEqualTo("0.00");
    // cleanup
    resultRepository.delete(result);
    participationRepository.delete(participation);
}
Also used : Participation(de.tum.in.www1.artemis.domain.Participation) Result(de.tum.in.www1.artemis.domain.Result) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 28 with Participation

use of de.tum.in.www1.artemis.domain.participation.Participation in project ArTEMiS by ls1intum.

the class LtiServiceIntTest method assertThatSuccessfulResultReturnsFullScore.

@Test
public void assertThatSuccessfulResultReturnsFullScore() {
    Participation participation = new Participation();
    participationRepository.save(participation);
    Result result = new Result();
    result.setParticipation(participation);
    result.setSuccessful(true);
    resultRepository.save(result);
    // String score = ltiService.getScoreForParticipation(participation);
    // assertThat(score).isEqualTo("1.00");
    // cleanup
    resultRepository.delete(result);
    participationRepository.delete(participation);
}
Also used : Participation(de.tum.in.www1.artemis.domain.Participation) Result(de.tum.in.www1.artemis.domain.Result) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 29 with Participation

use of de.tum.in.www1.artemis.domain.participation.Participation in project ArTEMiS by ls1intum.

the class LtiServiceIntTest method assertThatNoResultReturnsZeroScore.

@Test
public void assertThatNoResultReturnsZeroScore() {
    Participation participation = new Participation();
    participationRepository.save(participation);
    // String score = ltiService.getScoreForParticipation(participation);
    // assertThat(score).isEqualTo("0.00");
    // cleanup
    participationRepository.delete(participation);
}
Also used : Participation(de.tum.in.www1.artemis.domain.Participation) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 30 with Participation

use of de.tum.in.www1.artemis.domain.participation.Participation in project ArTEMiS by ls1intum.

the class LtiServiceIntTest method assertThatUnsuccessfulResultWith2of3FailedTestsReturnsCorrectScore.

@Test
public void assertThatUnsuccessfulResultWith2of3FailedTestsReturnsCorrectScore() {
    Participation participation = new Participation();
    participationRepository.save(participation);
    Result result = new Result();
    result.setParticipation(participation);
    result.setSuccessful(false);
    result.setResultString("2 of 3 failed");
    resultRepository.save(result);
    // String score = ltiService.getScoreForParticipation(participation);
    // assertThat(score).isEqualTo("0.33");
    // cleanup
    resultRepository.delete(result);
    participationRepository.delete(participation);
}
Also used : Participation(de.tum.in.www1.artemis.domain.Participation) Result(de.tum.in.www1.artemis.domain.Result) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Aggregations

StudentParticipation (de.tum.in.www1.artemis.domain.participation.StudentParticipation)181 WithMockUser (org.springframework.security.test.context.support.WithMockUser)138 Test (org.junit.jupiter.api.Test)124 ProgrammingExerciseStudentParticipation (de.tum.in.www1.artemis.domain.participation.ProgrammingExerciseStudentParticipation)70 Participation (de.tum.in.www1.artemis.domain.participation.Participation)54 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)50 ZonedDateTime (java.time.ZonedDateTime)47 ModelingSubmission (de.tum.in.www1.artemis.domain.modeling.ModelingSubmission)44 PreAuthorize (org.springframework.security.access.prepost.PreAuthorize)44 ModelingExercise (de.tum.in.www1.artemis.domain.modeling.ModelingExercise)42 EntityNotFoundException (de.tum.in.www1.artemis.web.rest.errors.EntityNotFoundException)42 AbstractSpringIntegrationBambooBitbucketJiraTest (de.tum.in.www1.artemis.AbstractSpringIntegrationBambooBitbucketJiraTest)38 QuizExercise (de.tum.in.www1.artemis.domain.quiz.QuizExercise)38 TextPlagiarismResult (de.tum.in.www1.artemis.domain.plagiarism.text.TextPlagiarismResult)34 Collectors (java.util.stream.Collectors)34 HttpHeaders (org.springframework.http.HttpHeaders)34 de.tum.in.www1.artemis.domain (de.tum.in.www1.artemis.domain)33 Result (de.tum.in.www1.artemis.domain.Result)33 Exam (de.tum.in.www1.artemis.domain.exam.Exam)32 ModelingPlagiarismResult (de.tum.in.www1.artemis.domain.plagiarism.modeling.ModelingPlagiarismResult)32