Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
duniter4j
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
clients
java
duniter4j
Commits
74af28aa
Commit
74af28aa
authored
6 years ago
by
Benoit Lavenier
Browse files
Options
Downloads
Patches
Plain Diff
[enh] Add Unit test on endpoints parsing
parent
b5d25dc9
No related branches found
No related tags found
No related merge requests found
Pipeline
#4612
passed
6 years ago
Stage: github-sync
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
duniter4j-core-client/src/test/java/org/duniter/core/client/model/bma/EndpointsTest.java
+17
-7
17 additions, 7 deletions
...java/org/duniter/core/client/model/bma/EndpointsTest.java
with
17 additions
and
7 deletions
duniter4j-core-client/src/test/java/org/duniter/core/client/model/bma/EndpointsTest.java
+
17
−
7
View file @
74af28aa
...
...
@@ -8,6 +8,7 @@ public class EndpointsTest {
@Test
public
void
parse
()
throws
Exception
{
// Parse valid endpoints
NetworkPeering
.
Endpoint
ep
=
Endpoints
.
parse
(
"BASIC_MERKLED_API g1.duniter.fr 81.81.81.81 80"
);
Assert
.
assertNotNull
(
ep
);
Assert
.
assertEquals
(
EndpointApi
.
BASIC_MERKLED_API
,
ep
.
api
);
...
...
@@ -43,13 +44,6 @@ public class EndpointsTest {
Assert
.
assertNotNull
(
ep
.
id
);
Assert
.
assertNotNull
(
ep
.
path
);
// path without slash
ep
=
Endpoints
.
parse
(
"WS2P 90e9b12 duniter.g1.1000i100.fr 443 ws2p"
);
Assert
.
assertNotNull
(
ep
);
Assert
.
assertEquals
(
ep
.
api
,
EndpointApi
.
WS2P
);
Assert
.
assertNotNull
(
ep
.
id
);
Assert
.
assertNotNull
(
ep
.
path
);
ep
=
Endpoints
.
parse
(
"WS2PTOR 1be86653 3k2zovlpihbt3j3g.onion 20901"
);
Assert
.
assertNotNull
(
ep
);
Assert
.
assertNotNull
(
ep
.
id
);
...
...
@@ -65,6 +59,22 @@ public class EndpointsTest {
Assert
.
assertNull
(
ep
.
id
);
Assert
.
assertNull
(
ep
.
path
);
// Parse Invalid endpoints
// FIXME: make sure this must failed (missing port)
ep
=
Endpoints
.
parse
(
"BMAS g1.cgeek.fr"
);
Assert
.
assertNotNull
(
ep
);
Assert
.
assertNull
(
ep
.
api
);
// FIXME: make sure this must failed (because bad ID)
ep
=
Endpoints
.
parse
(
"WS2P R8t2sg7w g1.ambau.ovh 443"
);
Assert
.
assertNotNull
(
ep
);
Assert
.
assertNull
(
ep
.
api
);
// FIXME: make sure this must failed (missing path first '/')
ep
=
Endpoints
.
parse
(
"WS2P 90e9b12 duniter.g1.1000i100.fr 443 ws2p"
);
Assert
.
assertNotNull
(
ep
);
Assert
.
assertNull
(
ep
.
api
);
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment