aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-db/src/test/java/org/sonar/db/component/SnapshotTesting.java
diff options
context:
space:
mode:
Diffstat (limited to 'sonar-db/src/test/java/org/sonar/db/component/SnapshotTesting.java')
-rw-r--r--sonar-db/src/test/java/org/sonar/db/component/SnapshotTesting.java10
1 files changed, 6 insertions, 4 deletions
diff --git a/sonar-db/src/test/java/org/sonar/db/component/SnapshotTesting.java b/sonar-db/src/test/java/org/sonar/db/component/SnapshotTesting.java
index 65d2aca5c72..727adc6f0f4 100644
--- a/sonar-db/src/test/java/org/sonar/db/component/SnapshotTesting.java
+++ b/sonar-db/src/test/java/org/sonar/db/component/SnapshotTesting.java
@@ -20,20 +20,22 @@
package org.sonar.db.component;
-import com.google.common.base.Preconditions;
import org.assertj.core.util.Strings;
+import static com.google.common.base.Preconditions.checkNotNull;
+
public class SnapshotTesting {
/**
* Can be used for modules and files
*/
public static SnapshotDto createForComponent(ComponentDto component, SnapshotDto parentSnapshot) {
- Preconditions.checkNotNull(parentSnapshot.getId(), "The parent snapshot need to be persisted before creating this snapshot");
+ checkNotNull(parentSnapshot.getId(), "The parent snapshot need to be persisted before creating this snapshot");
Long parentRootId = parentSnapshot.getRootId();
return createBasicSnapshot(component, parentSnapshot.getRootProjectId())
.setRootId(parentRootId != null ? parentRootId : parentSnapshot.getId())
.setParentId(parentSnapshot.getId())
+ .setDepth(parentSnapshot.getDepth()+1)
.setPath(
Strings.isNullOrEmpty(parentSnapshot.getPath()) ? Long.toString(parentSnapshot.getId()) + "." : parentSnapshot.getPath() + Long.toString(parentSnapshot.getId()) + ".");
}
@@ -57,8 +59,8 @@ public class SnapshotTesting {
}
private static SnapshotDto createBasicSnapshot(ComponentDto component, Long rootProjectId) {
- Preconditions.checkNotNull(component.getId(), "The project need to be persisted before creating this snapshot");
- Preconditions.checkNotNull(rootProjectId, "Root project id is null");
+ checkNotNull(component.getId(), "The project need to be persisted before creating this snapshot");
+ checkNotNull(rootProjectId, "Root project id is null");
return new SnapshotDto()
.setComponentId(component.getId())
.setRootProjectId(rootProjectId)