@@ -0,0 +1,2246 @@
+/*%0A * Copyright 2018 New Vector Ltd%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A *     http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0A%0Apackage org.matrix.androidsdk.util;%0A%0Aimport android.net.Uri;%0A%0Aimport org.junit.Assert;%0Aimport org.junit.FixMethodOrder;%0Aimport org.junit.Test;%0Aimport org.junit.runner.RunWith;%0Aimport org.junit.runners.MethodSorters;%0Aimport org.robolectric.RobolectricTestRunner;%0A%0Aimport java.util.Arrays;%0Aimport java.util.List;%0Aimport java.util.Map;%0A%0A@RunWith(RobolectricTestRunner.class)%0A@FixMethodOrder(MethodSorters.NAME_ASCENDING)%0Apublic class PermalinkUtilsTest %7B%0A%0A    // supported host list%0A    private static final List%3CString%3E sSupportedVectorHosts = Arrays.asList(%22vector.im%22, %22riot.im%22);%0A%0A    // supported paths list%0A    private static final List%3CString%3E sSupportedVectorLinkPaths = Arrays.asList(%22/beta/%22, %22/develop/%22, %22/app/%22, %22/staging/%22);%0A%0A%0A    @Test%0A    public void parseUniversalLink_standardCase() %7B%0A        Map%3CString, String%3E result = testUri(%22https://matrix.to/#/!GnEEPYXUhoaHbkFBNX:matrix.org/$154089010924835FMJsT:sorunome.de?via=jki.re&via=matrix.org&via=disroot.org&via=tchncs.de%22);%0A%0A        Assert.assertEquals(%22!GnEEPYXUhoaHbkFBNX:matrix.org%22, result.get(PermalinkUtils.ULINK_ROOM_ID_OR_ALIAS_KEY));%0A        Assert.assertEquals(%22$154089010924835FMJsT:sorunome.de%22, result.get(PermalinkUtils.ULINK_EVENT_ID_KEY));%0A        Assert.assertNull(result.get(PermalinkUtils.ULINK_GROUP_ID_KEY));%0A        Assert.assertNull(result.get(PermalinkUtils.ULINK_MATRIX_USER_ID_KEY));%0A    %7D%0A%0A%0A    private Map%3CString, String%3E testUri(String uri) %7B%0A        Map%3CString, String%3E result = PermalinkUtils.parseUniversalLink(Uri.parse(uri), sSupportedVectorHosts, sSupportedVectorLinkPaths);%0A%0A        Assert.assertNotNull(result);%0A%0A        return result;%0A    %7D%0A%7D%0A

Add unit test