3 * Copyright (C) 2009-2020 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.charset;
22 import org.junit.Test;
24 import static org.assertj.core.api.Assertions.assertThat;
26 public class ColumnDefTest {
29 public void isInSonarQubeTable_returns_false_if_sqlazure_system_table() {
30 ColumnDef underTest = new ColumnDef("sys.sysusers", "login", "charset", "collation", "NVARCHAR", 100L, false);
31 assertThat(underTest.isInSonarQubeTable()).isFalse();
33 underTest = new ColumnDef("SYS.SYSUSERS", "login", "charset", "collation", "NVARCHAR", 100L, false);
34 assertThat(underTest.isInSonarQubeTable()).isFalse();
38 public void isInSonarQubeTable_returns_true_if_table_created_by_sonarqube() {
39 ColumnDef underTest = new ColumnDef("project_measures", "text_value", "charset", "collation", "NVARCHAR", 100L, false);
40 assertThat(underTest.isInSonarQubeTable()).isTrue();
42 underTest = new ColumnDef("PROJECT_MEASURES", "text_value", "charset", "collation", "NVARCHAR", 100L, false);
43 assertThat(underTest.isInSonarQubeTable()).isTrue();
47 public void isInSonarQubeTable_returns_true_if_table_existed_in_previous_versions_of_sonarqube() {
48 ColumnDef underTest = new ColumnDef("activities", "kee", "charset", "collation", "NVARCHAR", 100L, false);
49 assertThat(underTest.isInSonarQubeTable()).isTrue();