This repository was archived by the owner on Jun 21, 2019. It is now read-only.
Commit b52c630 Maxime Dor
committed
1 parent e46acb5 commit b52c630 Copy full SHA for b52c630
File tree 2 files changed +7
-1
lines changed
main/java/io/kamax/matrix
test/java/io/kamax/matrix
2 files changed +7
-1
lines changed Original file line number Diff line number Diff line change 25
25
26
26
public class MatrixID implements _MatrixID {
27
27
28
- private static final Pattern matrixIdLaxPattern = Pattern .compile ("@(.*):(.+)" );
28
+ private static final Pattern matrixIdLaxPattern = Pattern .compile ("@(.*? ):(.+)" );
29
29
private static final Pattern matrixIdStrictPattern = Pattern .compile ("@([0-9a-z-.=_]+):(.+)" );
30
30
31
31
private String id ;
Original file line number Diff line number Diff line change @@ -29,6 +29,8 @@ public class MatrixIDTest {
29
29
private static String validMxId1 = "@john.doe:example.org" ;
30
30
private static String validMxId2 = "@john.doe:example.com" ;
31
31
private static String validMxId3 = "@JoHn.dOe:ExamPLE.ORG" ;
32
+ private static String validMxid4 = "@john:example.org:8449" ;
33
+ private static String validMxid5 = "@john:::1:8449" ;
32
34
33
35
private static String invalidMxId1 = "john.doe:example.org" ;
34
36
private static String invalidMxId2 = "@john.doeexample.org" ;
@@ -40,9 +42,13 @@ public class MatrixIDTest {
40
42
public void validMatrixIDs () {
41
43
_MatrixID mxId1 = new MatrixID (validMxId1 );
42
44
_MatrixID mxId3 = new MatrixID (validMxId3 );
45
+ _MatrixID mxId4 = new MatrixID (validMxid4 );
46
+ _MatrixID mxId5 = new MatrixID (validMxid5 );
43
47
assertTrue (validMxId1 .contentEquals (mxId1 .getId ()));
44
48
assertTrue ("john.doe" .contentEquals (mxId1 .getLocalPart ()));
45
49
assertTrue ("example.org" .contentEquals (mxId1 .getDomain ()));
50
+ assertTrue ("example.org:8449" .contentEquals (mxId4 .getDomain ()));
51
+ assertTrue ("::1:8449" .contentEquals (mxId5 .getDomain ()));
46
52
}
47
53
48
54
@ Test
You can’t perform that action at this time.
0 commit comments