3 * Copyright (C) 2009-2024 SonarSource SA
4 * mailto:info AT sonarsource DOT com
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 3 of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public License
17 * along with this program; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 package org.sonar.server.platform.db.migration;
22 import java.util.Date;
23 import org.junit.Test;
25 import static org.assertj.core.api.Assertions.assertThat;
27 public class DatabaseMigrationStateImplTest {
28 private DatabaseMigrationStateImpl underTest = new DatabaseMigrationStateImpl();
31 public void getStatus_returns_NONE_when_component_is_created() {
32 assertThat(underTest.getStatus()).isEqualTo(DatabaseMigrationState.Status.NONE);
36 public void getStatus_returns_argument_of_setStatus() {
37 for (DatabaseMigrationState.Status status : DatabaseMigrationState.Status.values()) {
38 underTest.setStatus(status);
40 assertThat(underTest.getStatus()).isEqualTo(status);
46 public void getStartedAt_returns_null_when_component_is_created() {
47 assertThat(underTest.getStartedAt()).isNull();
51 public void getStartedAt_returns_argument_of_setStartedAt() {
52 Date expected = new Date();
53 underTest.setStartedAt(expected);
55 assertThat(underTest.getStartedAt()).isSameAs(expected);
59 public void getError_returns_null_when_component_is_created() {
60 assertThat(underTest.getError()).isNull();
64 public void getError_returns_argument_of_setError() {
65 RuntimeException expected = new RuntimeException();
66 underTest.setError(expected);
68 assertThat(underTest.getError()).isSameAs(expected);