Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
apollo
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
openSource
apollo
Commits
9bf33f70
Commit
9bf33f70
authored
May 05, 2016
by
Jason Song
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add ut for property file with new line - \n
parent
605847dd
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
3 deletions
+19
-3
LocalFileConfigRepositoryTest.java
...ctrip/apollo/internals/LocalFileConfigRepositoryTest.java
+19
-3
No files found.
apollo-client/src/test/java/com/ctrip/apollo/internals/LocalFileConfigRepositoryTest.java
View file @
9bf33f70
...
...
@@ -14,6 +14,8 @@ import org.mockito.ArgumentCaptor;
import
org.unidal.lookup.ComponentTestCase
;
import
java.io.File
;
import
java.io.FileOutputStream
;
import
java.io.IOException
;
import
java.util.Properties
;
import
static
org
.
hamcrest
.
core
.
IsEqual
.
equalTo
;
...
...
@@ -82,12 +84,13 @@ public class LocalFileConfigRepositoryTest extends ComponentTestCase {
@Test
public
void
testLoadConfigWithLocalFile
()
throws
Exception
{
File
file
=
new
File
(
someBaseDir
,
assembleLocalCacheFileName
());
String
someKey
=
"someKey"
;
String
someValue
=
"someValue"
;
String
someValue
=
"someValue
\nxxx\nyyy
"
;
Files
.
write
(
someKey
+
"="
+
someValue
,
file
,
Charsets
.
UTF_8
);
Properties
someProperties
=
new
Properties
();
someProperties
.
setProperty
(
someKey
,
someValue
);
createLocalCachePropertyFile
(
someProperties
);
LocalFileConfigRepository
localRepo
=
new
LocalFileConfigRepository
(
someBaseDir
,
someNamespace
);
Properties
properties
=
localRepo
.
getConfig
();
...
...
@@ -186,4 +189,17 @@ public class LocalFileConfigRepositoryTest extends ComponentTestCase {
}
}
private
File
createLocalCachePropertyFile
(
Properties
properties
)
throws
IOException
{
File
file
=
new
File
(
someBaseDir
,
assembleLocalCacheFileName
());
FileOutputStream
in
=
null
;
try
{
in
=
new
FileOutputStream
(
file
);
properties
.
store
(
in
,
"Persisted by LocalFileConfigRepositoryTest"
);
}
finally
{
if
(
in
!=
null
)
{
in
.
close
();
}
}
return
file
;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment