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);
}
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);
}
Aggregations