-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Split the JUnit 4 rule and JUnit 5 extension into separate Maven modules
- Loading branch information
Showing
49 changed files
with
263 additions
and
157 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<artifactId>embedded-ldap-parent</artifactId> | ||
<groupId>org.zapodot</groupId> | ||
<version>0.9-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>embedded-ldap-core</artifactId> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>com.unboundid</groupId> | ||
<artifactId>unboundid-ldapsdk</artifactId> | ||
<version>${unboundid-ldapsdk.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.google.guava</groupId> | ||
<artifactId>guava</artifactId> | ||
<version>${guava.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>net.bytebuddy</groupId> | ||
<artifactId>byte-buddy</artifactId> | ||
<version>${byte-buddy.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.slf4j</groupId> | ||
<artifactId>slf4j-api</artifactId> | ||
<version>${slf4j.version}</version> | ||
</dependency> | ||
</dependencies> | ||
</project> |
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
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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,48 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<artifactId>embedded-ldap-parent</artifactId> | ||
<groupId>org.zapodot</groupId> | ||
<version>0.9-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>embedded-ldap-junit</artifactId> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.zapodot</groupId> | ||
<artifactId>embedded-ldap-core</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>junit</groupId> | ||
<artifactId>junit</artifactId> | ||
<version>${junit.version}</version> | ||
</dependency> | ||
|
||
<!-- Test dependencies --> | ||
<dependency> | ||
<groupId>ch.qos.logback</groupId> | ||
<artifactId>logback-classic</artifactId> | ||
<version>${logback.version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.bouncycastle</groupId> | ||
<artifactId>bcprov-jdk15on</artifactId> | ||
<version>${bouncycastle.version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.bouncycastle</groupId> | ||
<artifactId>bcpkix-jdk15on</artifactId> | ||
<version>${bouncycastle.version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
</project> |
File renamed without changes.
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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,35 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<parent> | ||
<artifactId>embedded-ldap-parent</artifactId> | ||
<groupId>org.zapodot</groupId> | ||
<version>0.9-SNAPSHOT</version> | ||
</parent> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<artifactId>embedded-ldap-junit5</artifactId> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.zapodot</groupId> | ||
<artifactId>embedded-ldap-core</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.junit.jupiter</groupId> | ||
<artifactId>junit-jupiter-api</artifactId> | ||
<version>${junit5.version}</version> | ||
</dependency> | ||
|
||
<!-- Test dependencies --> | ||
<dependency> | ||
<groupId>org.junit.jupiter</groupId> | ||
<artifactId>junit-jupiter-engine</artifactId> | ||
<version>${junit5.version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
</project> |
File renamed without changes.
File renamed without changes.
File renamed without changes.
99 changes: 99 additions & 0 deletions
99
...-junit5/src/test/java/org/zapodot/junit/ldap/junit5/EmbeddedLdapExtensionBuilderTest.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,99 @@ | ||
package org.zapodot.junit.ldap.junit5; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertNotNull; | ||
import static org.junit.jupiter.api.Assertions.assertThrows; | ||
|
||
class EmbeddedLdapExtensionBuilderTest { | ||
|
||
@Test | ||
void bindingToLegalPort() { | ||
assertNotNull(EmbeddedLdapExtensionBuilder.newInstance().bindingToPort(9999)); | ||
} | ||
|
||
@Test | ||
void testPrematureLdapConnection() { | ||
assertThrows(IllegalStateException.class, () -> | ||
EmbeddedLdapExtensionBuilder.newInstance().build().ldapConnection() | ||
); | ||
} | ||
|
||
@Test | ||
void testPrematureContext() { | ||
assertThrows(IllegalStateException.class, () -> | ||
EmbeddedLdapExtensionBuilder.newInstance().build().context() | ||
); | ||
} | ||
|
||
@Test | ||
void testUnknownLDIF() { | ||
assertThrows(IllegalArgumentException.class, () -> | ||
EmbeddedLdapExtensionBuilder.newInstance().importingLdifs("nonExisting.ldif").build() | ||
); | ||
} | ||
|
||
@Test | ||
void testNullLDIF() { | ||
assertNotNull(EmbeddedLdapExtensionBuilder.newInstance().importingLdifs(null).build()); | ||
|
||
} | ||
|
||
@Test | ||
void testIllegalDSN() { | ||
assertThrows(IllegalStateException.class, () -> | ||
EmbeddedLdapExtensionBuilder.newInstance().usingBindDSN("bindDsn").build() | ||
); | ||
} | ||
|
||
@Test | ||
void testIllegalPort() { | ||
assertThrows(IllegalArgumentException.class, () -> | ||
EmbeddedLdapExtensionBuilder.newInstance().bindingToPort(Integer.MIN_VALUE).build() | ||
); | ||
} | ||
|
||
@Test | ||
void testSchemaNotFound() { | ||
assertThrows(IllegalArgumentException.class, () -> | ||
EmbeddedLdapExtensionBuilder.newInstance().withSchema("non-existing-schema.ldif").build() | ||
); | ||
} | ||
|
||
@Test | ||
void testSchemaIsNotAFile() { | ||
assertThrows(IllegalArgumentException.class, () -> | ||
EmbeddedLdapExtensionBuilder.newInstance().withSchema("folder").build() | ||
); | ||
} | ||
|
||
@Test | ||
void testSchemaIsInvalid() { | ||
assertThrows(IllegalArgumentException.class, () -> | ||
EmbeddedLdapExtensionBuilder.newInstance().withSchema("invalid.ldif").build() | ||
); | ||
} | ||
|
||
@Test | ||
void testSchemaFileUnsupportedIsInvalid() { | ||
assertThrows(IllegalArgumentException.class, () -> | ||
EmbeddedLdapExtensionBuilder.newInstance().withSchema("\"#%¤&&%/¤##¤¤").build() | ||
); | ||
} | ||
|
||
@Test | ||
void testInvalidPort() { | ||
assertThrows(IllegalArgumentException.class, () -> | ||
EmbeddedLdapExtensionBuilder.newInstance().bindingToPort(Integer.MAX_VALUE) | ||
); | ||
} | ||
|
||
@Test | ||
void testInvalidBindAddress() { | ||
assertThrows(IllegalArgumentException.class, () -> | ||
EmbeddedLdapExtensionBuilder.newInstance().bindingToAddress("åpsldfåpl") | ||
); | ||
} | ||
|
||
|
||
} |
File renamed without changes.
File renamed without changes.
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,28 @@ | ||
version: 1 | ||
|
||
dn: dc=zapodot,dc=org | ||
objectClass: domain | ||
objectClass: top | ||
dc: zapodot | ||
|
||
dn: ou=groups,dc=zapodot,dc=org | ||
objectclass: top | ||
objectclass: organizationalUnit | ||
ou: groups | ||
|
||
dn: ou=people,dc=zapodot,dc=org | ||
objectclass: top | ||
objectclass: organizationalUnit | ||
ou: people | ||
|
||
dn: cn=Sondre Eikanger Kvalo,ou=people,dc=zapodot,dc=org | ||
objectclass: top | ||
objectclass: person | ||
objectclass: organizationalPerson | ||
objectclass: inetOrgPerson | ||
uid: zapodot | ||
userPassword: password | ||
cn: Sondre Eikanger Kvalo | ||
cn:: U29uZHJlIEVpa2FuZ2VyIEt2YWzDuA== | ||
sn: Person | ||
description: Developer |
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
Oops, something went wrong.