forked from ctron/rpm-builder
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
see ctron#42 Signed-off-by: Oliver Matz <[email protected]>
- Loading branch information
1 parent
6ed50a1
commit 4a4c8b1
Showing
1 changed file
with
55 additions
and
0 deletions.
There are no files selected for viewing
55 changes: 55 additions & 0 deletions
55
src/test/java/de/dentrassi/rpm/builder/EntryDetailsTest.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,55 @@ | ||
package de.dentrassi.rpm.builder; | ||
|
||
import org.eclipse.packager.rpm.FileFlags; | ||
import org.eclipse.packager.rpm.build.FileInformation; | ||
import org.junit.Test; | ||
|
||
import java.util.Set; | ||
|
||
import static org.junit.Assert.assertArrayEquals; | ||
|
||
/** | ||
* Test class de.dentrassi.rpm.builder.EntryDetails. | ||
*/ | ||
public class EntryDetailsTest | ||
{ | ||
/** | ||
* Verify that empty {@link EntryDetails} result in empty set of {@link FileFlags}. | ||
*/ | ||
@Test | ||
public void applyEmpty() | ||
{ | ||
final EntryDetails entryDetails = new EntryDetails(); | ||
doTest(new FileFlags[] {}, entryDetails); | ||
} | ||
|
||
/** | ||
* Verify that {@link EntryDetails#setReadme(java.lang.Boolean)} correctly controls {@link FileFlags#README}. | ||
*/ | ||
@Test | ||
public void applyReadmeTrue() | ||
{ | ||
final EntryDetails entryDetails = new EntryDetails(); | ||
entryDetails.setReadme(true); | ||
doTest(new FileFlags[] {FileFlags.README}, entryDetails); | ||
} | ||
|
||
/** | ||
* False negative? See https://github.com/ctron/rpm-builder/issues/42 | ||
*/ | ||
@Test | ||
public void applyReadmeFalse() | ||
{ | ||
final EntryDetails entryDetails = new EntryDetails(); | ||
entryDetails.setReadme(false); | ||
doTest(new FileFlags[] {FileFlags.README}, entryDetails); // questionable | ||
} | ||
|
||
private static void doTest(FileFlags[] expectedResult, final EntryDetails entryDetails) | ||
{ | ||
final FileInformation fileInformation = new FileInformation(); | ||
entryDetails.apply(fileInformation); | ||
final Set<FileFlags> fileFlags = fileInformation.getFileFlags(); | ||
assertArrayEquals(expectedResult, fileFlags.toArray()); | ||
} | ||
} |