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
7ffe731a
Commit
7ffe731a
authored
Jun 16, 2017
by
Jason Song
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "add DataSourceValidatorTest"
This reverts commit
037e0036
.
parent
81fd3f07
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
1 addition
and
57 deletions
+1
-57
AllTests.java
...test/java/com/ctrip/framework/apollo/common/AllTests.java
+1
-2
DataSourceValidatorTest.java
...ramework/apollo/common/utils/DataSourceValidatorTest.java
+0
-55
No files found.
apollo-common/src/test/java/com/ctrip/framework/apollo/common/AllTests.java
View file @
7ffe731a
package
com
.
ctrip
.
framework
.
apollo
.
common
;
import
com.ctrip.framework.apollo.common.utils.DataSourceValidatorTest
;
import
com.ctrip.framework.apollo.common.utils.InputValidatorTest
;
import
org.junit.runner.RunWith
;
...
...
@@ -9,7 +8,7 @@ import org.junit.runners.Suite.SuiteClasses;
@RunWith
(
Suite
.
class
)
@SuiteClasses
({
InputValidatorTest
.
class
,
DataSourceValidatorTest
.
class
InputValidatorTest
.
class
})
public
class
AllTests
{
...
...
apollo-common/src/test/java/com/ctrip/framework/apollo/common/utils/DataSourceValidatorTest.java
deleted
100644 → 0
View file @
81fd3f07
package
com
.
ctrip
.
framework
.
apollo
.
common
.
utils
;
import
org.junit.Before
;
import
org.junit.Test
;
import
java.sql.Connection
;
import
static
org
.
junit
.
Assert
.*;
import
static
org
.
mockito
.
Matchers
.
anyInt
;
import
static
org
.
mockito
.
Mockito
.
mock
;
import
static
org
.
mockito
.
Mockito
.
when
;
/**
* @author Jason Song(song_s@ctrip.com)
*/
public
class
DataSourceValidatorTest
{
private
DataSourceValidator
datasourceValidator
;
@Before
public
void
setUp
()
throws
Exception
{
datasourceValidator
=
new
DataSourceValidator
();
}
@Test
public
void
testValidateSuccessfully
()
throws
Exception
{
Connection
someConnection
=
mock
(
Connection
.
class
);
int
someValidationAction
=
1
;
when
(
someConnection
.
isValid
(
anyInt
())).
thenReturn
(
true
);
assertTrue
(
datasourceValidator
.
validate
(
someConnection
,
someValidationAction
));
}
@Test
public
void
testValidateFailed
()
throws
Exception
{
Connection
someConnection
=
mock
(
Connection
.
class
);
int
someValidationAction
=
1
;
when
(
someConnection
.
isValid
(
anyInt
())).
thenReturn
(
false
);
assertFalse
(
datasourceValidator
.
validate
(
someConnection
,
someValidationAction
));
}
@Test
public
void
testValidateWithException
()
throws
Exception
{
Connection
someConnection
=
mock
(
Connection
.
class
);
int
someValidationAction
=
1
;
when
(
someConnection
.
isValid
(
anyInt
())).
thenThrow
(
new
RuntimeException
(
"error"
));
assertFalse
(
datasourceValidator
.
validate
(
someConnection
,
someValidationAction
));
}
}
\ No newline at end of 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