forked from jooby-project/jooby
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathArgsConfTest.java
More file actions
38 lines (29 loc) · 977 Bytes
/
ArgsConfTest.java
File metadata and controls
38 lines (29 loc) · 977 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package org.jooby;
import static org.junit.Assert.assertEquals;
import org.junit.Test;
import com.typesafe.config.Config;
import com.typesafe.config.ConfigFactory;
public class ArgsConfTest {
@Test
public void keypair() {
Config args = Jooby.args(new String[]{"p.foo=bar", "p.bar=foo" });
assertEquals("bar", args.getConfig("p").getString("foo"));
assertEquals("foo", args.getConfig("p").getString("bar"));
}
@Test
public void env() {
Config args = Jooby.args(new String[]{"foo" });
assertEquals("foo", args.getConfig("application").getString("env"));
}
@Test
public void defnamespace() {
Config args = Jooby.args(new String[]{"port=8080" });
assertEquals(8080, args.getConfig("application").getInt("port"));
assertEquals(8080, args.getInt("port"));
}
@Test
public void noargs() {
assertEquals(ConfigFactory.empty(), Jooby.args(null));
assertEquals(ConfigFactory.empty(), Jooby.args(new String[0]));
}
}