Search in sources :

Example 11 with Exercise

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

the class ExerciseResourceIntTest method createExercise.

@Test
@Transactional
public void createExercise() throws Exception {
    int databaseSizeBeforeCreate = exerciseRepository.findAll().size();
    // Create the Exercise
    restExerciseMockMvc.perform(post("/api/exercises").contentType(TestUtil.APPLICATION_JSON_UTF8).content(TestUtil.convertObjectToJsonBytes(exercise))).andExpect(status().isCreated());
    // Validate the Exercise in the database
    List<Exercise> exerciseList = exerciseRepository.findAll();
    assertThat(exerciseList).hasSize(databaseSizeBeforeCreate + 1);
    Exercise testExercise = exerciseList.get(exerciseList.size() - 1);
    assertThat(testExercise.getTitle()).isEqualTo(DEFAULT_TITLE);
    assertThat(testExercise.getReleaseDate()).isEqualTo(DEFAULT_RELEASE_DATE);
    assertThat(testExercise.getDueDate()).isEqualTo(DEFAULT_DUE_DATE);
}
Also used : ProgrammingExercise(de.tum.in.www1.artemis.domain.ProgrammingExercise) Exercise(de.tum.in.www1.artemis.domain.Exercise) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) Transactional(org.springframework.transaction.annotation.Transactional)

Example 12 with Exercise

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

the class ExerciseResourceIntTest method equalsVerifier.

@Test
@Transactional
public void equalsVerifier() throws Exception {
    TestUtil.equalsVerifier(Exercise.class);
    Exercise exercise1 = new ProgrammingExercise();
    exercise1.setId(1L);
    Exercise exercise2 = new ProgrammingExercise();
    exercise2.setId(exercise1.getId());
    assertThat(exercise1).isEqualTo(exercise2);
    exercise2.setId(2L);
    assertThat(exercise1).isNotEqualTo(exercise2);
    exercise1.setId(null);
    assertThat(exercise1).isNotEqualTo(exercise2);
}
Also used : ProgrammingExercise(de.tum.in.www1.artemis.domain.ProgrammingExercise) Exercise(de.tum.in.www1.artemis.domain.Exercise) ProgrammingExercise(de.tum.in.www1.artemis.domain.ProgrammingExercise) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) Transactional(org.springframework.transaction.annotation.Transactional)

Aggregations

ProgrammingExercise (de.tum.in.www1.artemis.domain.ProgrammingExercise)6 Transactional (org.springframework.transaction.annotation.Transactional)6 Timed (com.codahale.metrics.annotation.Timed)4 Exercise (de.tum.in.www1.artemis.domain.Exercise)4 PreAuthorize (org.springframework.security.access.prepost.PreAuthorize)4 Course (de.tum.in.www1.artemis.domain.Course)3 User (de.tum.in.www1.artemis.domain.User)3 IOException (java.io.IOException)3 Test (org.junit.Test)3 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)3 ExerciseRepository (de.tum.in.www1.artemis.repository.ExerciseRepository)2 URI (java.net.URI)2 Path (java.nio.file.Path)2 GitAPIException (org.eclipse.jgit.api.errors.GitAPIException)2 Result (de.tum.in.www1.artemis.domain.Result)1 BambooException (de.tum.in.www1.artemis.exception.BambooException)1 LtiLaunchRequestDTO (de.tum.in.www1.artemis.web.rest.dto.LtiLaunchRequestDTO)1 BadRequestAlertException (de.tum.in.www1.artemis.web.rest.errors.BadRequestAlertException)1