Skip to content

Commit

Permalink
extract pure java dotenv into dep
Browse files Browse the repository at this point in the history
  • Loading branch information
cdimascio committed Sep 19, 2020
1 parent ecc1c75 commit a3094dd
Show file tree
Hide file tree
Showing 8 changed files with 254 additions and 514 deletions.
447 changes: 240 additions & 207 deletions pom.xml

Large diffs are not rendered by default.

158 changes: 0 additions & 158 deletions src/main/kotlin/io/github/cdimascio/dotenv/Dotenv.kt

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

10 changes: 5 additions & 5 deletions src/test/java/tests/JavaTests.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package tests;

import io.github.cdimascio.dotenv.DotEnvException;
import io.github.cdimascio.dotenv.DotenvException;
import io.github.cdimascio.dotenv.Dotenv;
import io.github.cdimascio.dotenv.DotenvEntriesFilter;
import io.github.cdimascio.dotenv.Dotenv.EntriesFilter;
import io.github.cdimascio.dotenv.DotenvEntry;
import org.junit.Before;
import org.junit.Test;
Expand All @@ -27,12 +27,12 @@ public void setUp() {
envVars.put("WITHOUT_VALUE", "");
}

@Test(expected = DotEnvException.class)
@Test(expected = DotenvException.class)
public void throwIfMalconfigured() {
Dotenv.configure().load();
}

@Test(expected = DotEnvException.class)
@Test(expected = DotenvException.class)
public void load() {
Dotenv dotenv = Dotenv.load();

Expand Down Expand Up @@ -62,7 +62,7 @@ public void iteratorOverDotenvWithFilter() {
.ignoreIfMalformed()
.load();

Set<DotenvEntry> entriesInFile = dotenv.entries(DotenvEntriesFilter.DECLARED_IN_ENV_FILE);
Set<DotenvEntry> entriesInFile = dotenv.entries(EntriesFilter.DECLARED_IN_ENV_FILE);
Set<DotenvEntry> entriesAll = dotenv.entries();
assertTrue(entriesInFile.size() < entriesAll.size());

Expand Down
6 changes: 3 additions & 3 deletions src/test/kotlin/tests/BasicTests.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package tests

import io.github.cdimascio.dotenv.DotEnvException
import io.github.cdimascio.dotenv.DotenvException
import io.github.cdimascio.dotenv.Dotenv
import kotlin.test.assertEquals
import kotlin.test.assertNotNull
Expand All @@ -15,7 +15,7 @@ class DotEnvTest {
"MULTI_LINE" to "hello\\nworld"
)

@test(expected = DotEnvException::class)
@test(expected = DotenvException::class)
fun dotenvMalformed() {
Dotenv.configure()
.directory("./src/test/resources")
Expand Down Expand Up @@ -113,7 +113,7 @@ class DotEnvTest {
}
}

@test(expected = DotEnvException::class)
@test(expected = DotenvException::class)
fun dotenvMissing() {
Dotenv.configure()
.directory("/missing/.env")
Expand Down
12 changes: 6 additions & 6 deletions src/test/kotlin/tests/DslTests.kt
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package tests

import io.github.cdimascio.dotenv.DotEnvException
import io.github.cdimascio.dotenv.DotenvException
import io.github.cdimascio.dotenv.Dotenv
import io.github.cdimascio.dotenv.DotenvEntriesFilter
import io.github.cdimascio.dotenv.Dotenv.EntriesFilter
import io.github.cdimascio.dotenv.dotenv
import junit.framework.Assert.assertTrue
import kotlin.test.assertTrue
import kotlin.test.assertEquals
import kotlin.test.assertNotEquals
import kotlin.test.assertNotNull
Expand All @@ -24,7 +24,7 @@ class DotEnvDslTest {
"HOME" to "dotenv_test_home"
)

@test(expected = DotEnvException::class)
@test(expected = DotenvException::class)
fun dotenvMalformed() {
dotenv()
}
Expand Down Expand Up @@ -100,7 +100,7 @@ class DotEnvDslTest {
.ignoreIfMalformed()
.load()

val entriesInFile = dotenv.entries(DotenvEntriesFilter.DECLARED_IN_ENV_FILE)
val entriesInFile = dotenv.entries(EntriesFilter.DECLARED_IN_ENV_FILE)
val entriesAll = dotenv.entries()
assertTrue(entriesInFile.size < entriesAll.size)

Expand Down Expand Up @@ -128,7 +128,7 @@ class DotEnvDslTest {
assertHostEnvVar(env)
}

@test(expected = DotEnvException::class)
@test(expected = DotenvException::class)
fun dotenvMissing() {
dotenv {
directory = "/missing/.env"
Expand Down

0 comments on commit a3094dd

Please sign in to comment.