| 1 |
/* |
| 2 |
* Copyright 2015-2020 the original author or authors |
| 3 |
* |
| 4 |
* This software is licensed under the Apache License, Version 2.0, |
| 5 |
* the GNU Lesser General Public License version 2 or later ("LGPL") |
| 6 |
* and the WTFPL. |
| 7 |
* You may choose either license to govern your use of this software only |
| 8 |
* upon the condition that you accept all of the terms of either |
| 9 |
* the Apache License 2.0, the LGPL 2.1+ or the WTFPL. |
| 10 |
*/ |
| 11 |
package org.minidns.util; |
| 12 |
|
| 13 |
import org.junit.jupiter.api.Test; |
| 14 |
|
| 15 |
import static org.junit.jupiter.api.Assertions.assertFalse; |
| 16 |
import static org.junit.jupiter.api.Assertions.assertTrue; |
| 17 |
|
| 18 |
public class NameUtilTest { |
| 19 |
|
| 20 |
@Test |
| 21 |
public void idnEqualsTest() { |
| 22 |
assertTrue(NameUtil.idnEquals(null, null)); |
| 23 |
assertTrue(NameUtil.idnEquals("domain.example", "domain.example")); |
| 24 |
assertTrue(NameUtil.idnEquals("dömäin.example", "xn--dmin-moa0i.example")); |
| 25 |
assertTrue(NameUtil.idnEquals("موقع.وزارة-الاتصالات.مصر", "xn--4gbrim.xn----ymcbaaajlc6dj7bxne2c.xn--wgbh1c")); |
| 26 |
|
| 27 |
assertFalse(NameUtil.idnEquals("dömäin.example", null)); |
| 28 |
assertFalse(NameUtil.idnEquals(null, "domain.example")); |
| 29 |
assertFalse(NameUtil.idnEquals("dömäin.example", "domain.example")); |
| 30 |
assertFalse(NameUtil.idnEquals("", "domain.example")); |
| 31 |
} |
| 32 |
|
| 33 |
} |