1 |
|
package liquibase.changelog; |
2 |
|
|
3 |
|
import org.junit.Before; |
4 |
|
import org.junit.Test; |
5 |
|
import static org.junit.Assert.*; |
6 |
|
import liquibase.database.core.H2Database; |
7 |
|
|
8 |
|
import java.util.Arrays; |
9 |
|
|
10 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (27) |
Complexity: 6 |
Complexity Density: 0.29 |
|
11 |
|
public class ChangeLogParametersTest { |
12 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
1
PASS
|
|
13 |
1
|
@Test... |
14 |
|
public void setParameterValue_doubleSet() { |
15 |
1
|
ChangeLogParameters changeLogParameters = new ChangeLogParameters(); |
16 |
|
|
17 |
1
|
changeLogParameters.set("doubleSet", "originalValue"); |
18 |
1
|
changeLogParameters.set("doubleSet", "newValue"); |
19 |
|
|
20 |
1
|
assertEquals("re-setting a param should not overwrite the value (like how ant works)", "originalValue", changeLogParameters.getValue("doubleSet")); |
21 |
|
} |
22 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
1
PASS
|
|
23 |
1
|
@Test... |
24 |
|
public void getParameterValue_systemProperty() { |
25 |
1
|
ChangeLogParameters changeLogParameters = new ChangeLogParameters(); |
26 |
|
|
27 |
1
|
assertEquals(System.getProperty("user.name"), changeLogParameters.getValue("user.name")); |
28 |
|
} |
29 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
1
PASS
|
|
30 |
1
|
@Test... |
31 |
|
public void setParameterValue_doubleSetButSecondWrongDatabase() { |
32 |
1
|
ChangeLogParameters changeLogParameters = new ChangeLogParameters(new H2Database()); |
33 |
|
|
34 |
1
|
changeLogParameters.set("doubleSet", "originalValue", null, "baddb"); |
35 |
1
|
changeLogParameters.set("doubleSet", "newValue"); |
36 |
|
|
37 |
1
|
assertEquals("newValue", changeLogParameters.getValue("doubleSet")); |
38 |
|
} |
39 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
1
PASS
|
|
40 |
1
|
@Test... |
41 |
|
public void setParameterValue_multiDatabase() { |
42 |
1
|
ChangeLogParameters changeLogParameters = new ChangeLogParameters(new H2Database()); |
43 |
|
|
44 |
1
|
changeLogParameters.set("doubleSet", "originalValue", null, "baddb, h2"); |
45 |
|
|
46 |
1
|
assertEquals("originalValue", changeLogParameters.getValue("doubleSet")); |
47 |
|
} |
48 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
1
PASS
|
|
49 |
1
|
@Test... |
50 |
|
public void setParameterValue_rightDBWrongContext() { |
51 |
1
|
ChangeLogParameters changeLogParameters = new ChangeLogParameters(new H2Database()); |
52 |
1
|
changeLogParameters.setContexts(Arrays.asList("junit")); |
53 |
|
|
54 |
1
|
changeLogParameters.set("doubleSet", "originalValue", "anotherContext", "baddb, h2"); |
55 |
|
|
56 |
1
|
assertNull(changeLogParameters.getValue("doubleSet")); |
57 |
|
} |
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
1
PASS
|
|
58 |
1
|
@Test... |
59 |
|
public void setParameterValue_rightDBRightContext() { |
60 |
1
|
ChangeLogParameters changeLogParameters = new ChangeLogParameters(new H2Database()); |
61 |
1
|
changeLogParameters.setContexts(Arrays.asList("junit")); |
62 |
|
|
63 |
1
|
changeLogParameters.set("doubleSet", "originalValue", "junit", "baddb, h2"); |
64 |
|
|
65 |
1
|
assertEquals("originalValue", changeLogParameters.getValue("doubleSet")); |
66 |
|
} |
67 |
|
} |