Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
jacob_robertson
committed
Jul 22, 2011
1 parent
dc128ff
commit 3beb554
Showing
7 changed files
with
162 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package configurationslicing; | ||
|
||
import configurationslicing.jdk.JdkSlicer; | ||
import hudson.model.JDK; | ||
import junit.framework.TestCase; | ||
|
||
public class JdkSlicerTest extends TestCase { | ||
|
||
public void testJdkEquals() { | ||
doTestJdkEquals("h1", "h2", "n1", "n2", false); | ||
doTestJdkEquals("h1", "h1", "n1", "n2", false); | ||
doTestJdkEquals("h1", "h2", "n1", "n1", false); | ||
doTestJdkEquals("h1", "h1", "n1", "n1", true); | ||
|
||
doTestJdkEquals(null, null, null, null, true); | ||
doTestJdkEquals("h1", null, null, null, false); | ||
doTestJdkEquals(null, null, "n1", null, false); | ||
} | ||
private void doTestJdkEquals(String h1, String h2, String n1, String n2, boolean expect) { | ||
JDK j1 = new JDK(n1, h1); | ||
JDK j2 = new JDK(n2, h2); | ||
assertEquals(expect, JdkSlicer.JdkSlicerSpec.equals(j1, j2)); | ||
|
||
assertTrue(JdkSlicer.JdkSlicerSpec.equals(j1, j1)); | ||
assertTrue(JdkSlicer.JdkSlicerSpec.equals(j2, j2)); | ||
assertTrue(JdkSlicer.JdkSlicerSpec.equals(null, null)); | ||
|
||
assertFalse(JdkSlicer.JdkSlicerSpec.equals(j1, null)); | ||
assertFalse(JdkSlicer.JdkSlicerSpec.equals(j2, null)); | ||
assertFalse(JdkSlicer.JdkSlicerSpec.equals(null, j1)); | ||
assertFalse(JdkSlicer.JdkSlicerSpec.equals(null, j2)); | ||
} | ||
|
||
} |
39 changes: 39 additions & 0 deletions
39
src/test/java/configurationslicing/LogRotationSlicerTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package configurationslicing; | ||
|
||
import configurationslicing.logrotator.LogRotationSlicer; | ||
import hudson.tasks.LogRotator; | ||
import junit.framework.TestCase; | ||
|
||
public class LogRotationSlicerTest extends TestCase { | ||
|
||
public void testLogRotatorEquals() { | ||
doTestLogRotatorEquals(0, 0, 0, 0, true); | ||
doTestLogRotatorEquals(-1, -1, -1, -1, true); | ||
|
||
doTestLogRotatorEquals(1, 1, 1, 1, true); | ||
doTestLogRotatorEquals(1, 1, 2, 2, true); | ||
|
||
doTestLogRotatorEquals(1, -1, -1, -1, false); | ||
doTestLogRotatorEquals(-1, 1, -1, -1, false); | ||
doTestLogRotatorEquals(-1, -1, 1, -1, false); | ||
doTestLogRotatorEquals(-1, -1, -1, 1, false); | ||
|
||
doTestLogRotatorEquals(1, 1, 2, 3, false); | ||
doTestLogRotatorEquals(2, 3, 1, 1, false); | ||
} | ||
private void doTestLogRotatorEquals(int d1, int d2, int n1, int n2, boolean expect) { | ||
LogRotator r1 = new LogRotator(d1, n1); | ||
LogRotator r2 = new LogRotator(d2, n2); | ||
boolean equals = LogRotationSlicer.equals(r1, r2); | ||
assertEquals(expect, equals); | ||
assertFalse(LogRotationSlicer.equals(r1, null)); | ||
assertFalse(LogRotationSlicer.equals(null, r1)); | ||
assertFalse(LogRotationSlicer.equals(r2, null)); | ||
assertFalse(LogRotationSlicer.equals(null, r2)); | ||
|
||
assertTrue(LogRotationSlicer.equals(null, null)); | ||
assertTrue(LogRotationSlicer.equals(r1, r1)); | ||
assertTrue(LogRotationSlicer.equals(r2, r2)); | ||
} | ||
|
||
} |