-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
JUnit 5/AssertJ/Testcontainers migration
- Loading branch information
Showing
7 changed files
with
496 additions
and
75 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
44 changes: 15 additions & 29 deletions
44
src/test/java/de/dentrassi/rpm/builder/PackageEntryTest.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 |
---|---|---|
@@ -1,71 +1,57 @@ | ||
package de.dentrassi.rpm.builder; | ||
|
||
import static org.junit.Assert.*; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import java.io.File; | ||
|
||
import org.junit.Test; | ||
|
||
public class PackageEntryTest { | ||
public PackageEntryTest() { | ||
super(); | ||
} | ||
import static org.assertj.core.api.Assertions.assertThatCode; | ||
import static org.assertj.core.api.Assertions.assertThatThrownBy; | ||
|
||
class PackageEntryTest { | ||
@Test | ||
public void testValidateNameNull() { | ||
void testValidateNameNull() { | ||
final PackageEntry entry = new PackageEntry(); | ||
entry.setLinkTo("something-to-link-to"); | ||
|
||
assertThrows(IllegalStateException.class, () -> entry.validate()); | ||
assertThatThrownBy(entry::validate).isInstanceOf(IllegalStateException.class); | ||
} | ||
|
||
@Test | ||
public void testValidateNameEmpty() { | ||
void testValidateNameEmpty() { | ||
final PackageEntry entry = new PackageEntry(); | ||
entry.setName(""); | ||
entry.setLinkTo("something-to-link-to"); | ||
|
||
assertThrows(IllegalStateException.class, () -> entry.validate()); | ||
assertThatThrownBy(entry::validate).isInstanceOf(IllegalStateException.class); | ||
} | ||
|
||
@Test | ||
public void testValidateNoSource() { | ||
void testValidateNoSource() { | ||
final PackageEntry entry = new PackageEntry(); | ||
entry.setName("some-entry"); | ||
|
||
assertThrows(IllegalStateException.class, () -> entry.validate()); | ||
assertThatThrownBy(entry::validate).isInstanceOf(IllegalStateException.class); | ||
} | ||
|
||
@Test | ||
public void testValidateGhostNull() { | ||
void testValidateGhostNull() { | ||
final PackageEntry entry = new PackageEntry(); | ||
entry.setName("some-entry"); | ||
entry.setGhost(null); | ||
|
||
// no NullPointerException must be thrown | ||
assertThrows(IllegalStateException.class, () -> entry.validate()); | ||
assertThatThrownBy(entry::validate).isInstanceOf(IllegalStateException.class); | ||
} | ||
|
||
@Test | ||
public void testValidateGhostSource() { | ||
final PackageEntry entry = new PackageEntry(); | ||
entry.setName("some-entry"); | ||
entry.setGhost(Boolean.TRUE); | ||
|
||
try { | ||
entry.validate(); | ||
} catch (final RuntimeException e) { | ||
fail("Ghost entries do not require other sources, got error: " + e.getMessage()); | ||
} | ||
assertThatCode(entry::validate).withFailMessage("Ghost entries do not require other sources").doesNotThrowAnyException(); | ||
} | ||
|
||
@Test | ||
public void testValidateMultipleSourcesGhost() { | ||
void testValidateMultipleSourcesGhost() { | ||
final PackageEntry entry = new PackageEntry(); | ||
entry.setName("some-entry"); | ||
entry.setFile(new File("some-file-entry")); | ||
entry.setGhost(Boolean.TRUE); | ||
|
||
assertThrows(IllegalStateException.class, () -> entry.validate()); | ||
assertThatThrownBy(entry::validate).isInstanceOf(IllegalStateException.class); | ||
} | ||
} |
Oops, something went wrong.