-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added boolean type to StartupParameters
- Loading branch information
Alexey Timoshenko
committed
Jul 30, 2019
1 parent
f87b1e2
commit 7e232b1
Showing
3 changed files
with
47 additions
and
0 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
18 changes: 18 additions & 0 deletions
18
src/test/java/com/payneteasy/startup/parameters/IStartupConfig.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,18 @@ | ||
package com.payneteasy.startup.parameters; | ||
|
||
import java.io.File; | ||
|
||
public interface IStartupConfig { | ||
|
||
@AStartupParameter(name = "WEB_SERVER_PORT", value = "8080") | ||
int webServerPort(); | ||
|
||
@AStartupParameter(name = "WEB_SERVER_CONTEXT", value = "/") | ||
String webServerContext(); | ||
|
||
@AStartupParameter(name = "UPLOAD_DIR", value = "./uploadDir") | ||
File getUploadDir(); | ||
|
||
@AStartupParameter(name = "USE_DEBUG_MODE", value = "true") | ||
boolean useDebugMode(); | ||
} |
27 changes: 27 additions & 0 deletions
27
src/test/java/com/payneteasy/startup/parameters/StartupParametersFactoryTest.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,27 @@ | ||
package com.payneteasy.startup.parameters; | ||
|
||
import org.junit.Test; | ||
|
||
import java.io.File; | ||
|
||
import static org.junit.Assert.*; | ||
|
||
public class StartupParametersFactoryTest { | ||
|
||
@Test | ||
public void getStartupParametersTest() { | ||
IStartupConfig startupConfig = StartupParametersFactory.getStartupParameters(IStartupConfig.class); | ||
|
||
File file = startupConfig.getUploadDir(); | ||
assertEquals("./uploadDir", file.getPath()); | ||
|
||
int port = startupConfig.webServerPort(); | ||
assertEquals(8080, port); | ||
|
||
String webServerContext = startupConfig.webServerContext(); | ||
assertEquals("/", webServerContext); | ||
|
||
boolean useDebugMode = startupConfig.useDebugMode(); | ||
assertTrue(useDebugMode); | ||
} | ||
} |