Measure pastProfileMeasure = getPreviousMeasure(project, CoreMetrics.PROFILE);
if (pastProfileMeasure == null) {
- return; // first analysis
+ // first analysis
+ return;
}
int pastProfileId = pastProfileMeasure.getIntValue();
Measure pastProfileVersionMeasure = getPreviousMeasure(project, CoreMetrics.PROFILE_VERSION);
final int pastProfileVersion;
- if (pastProfileVersionMeasure == null) { // first analysis with versions
+ // first analysis with versions
+ if (pastProfileVersionMeasure == null) {
pastProfileVersion = 1;
} else {
pastProfileVersion = pastProfileVersionMeasure.getIntValue();
*/
public boolean isCompatibleWith(String sonarVersion) {
if (null == this.sonarVersion) {
- return true; // Plugins without sonar version are so old, they are compatible with a version containing this code
+ // Plugins without sonar version are so old, they are compatible with a version containing this code
+ return true;
}
Version minimumVersion = Version.createRelease(this.sonarVersion);
LOG.warn("Plugin " + plugin.getKey() + " is ignored because base plugin is not installed: " + plugin.getBasePlugin());
return false;
}
- base.createChildRealm(plugin.getKey()); // we create new realm to be able to return it by key without conversion to baseKey
+ // we create new realm to be able to return it by key without conversion to baseKey
+ base.createChildRealm(plugin.getKey());
for (File file : plugin.getDeployedFiles()) {
base.addURL(file.toURI().toURL());
}
List<PurgeableSnapshotDto> result = Lists.newArrayList();
result.addAll(mapper.selectPurgeableSnapshotsWithEvents(resourceId));
result.addAll(mapper.selectPurgeableSnapshotsWithoutEvents(resourceId));
- Collections.sort(result);// sort by date
+ // sort by date
+ Collections.sort(result);
return result;
} finally {
MyBatis.closeQuietly(session);
import java.util.Properties;
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
+import static org.fest.assertions.Assertions.assertThat;
public class PostgreSQLSequenceGeneratorTest {
PostgreSQLSequenceGenerator generator = new PostgreSQLSequenceGenerator();
generator.configure(null, props, new PostgreSql.PostgreSQLWithDecimalDialect());
- assertThat(generator.getSequenceName(), is("my_table_id_seq"));
+ assertThat(generator.getSequenceName()).isEqualTo("my_table_id_seq");
}
+ @Test
+ public void should_not_fail_if_table_name_can_not_be_loaded() {
+ Properties props = new Properties();
+ PostgreSQLSequenceGenerator generator = new PostgreSQLSequenceGenerator();
+ generator.configure(null, props, new PostgreSql.PostgreSQLWithDecimalDialect());
+ assertThat(generator.getSequenceName()).isNotEmpty();
+ }
}