-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
59 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package com.uid2.client; | ||
|
||
import org.junit.jupiter.api.Assertions; | ||
import org.junit.jupiter.api.BeforeAll; | ||
import org.junit.jupiter.params.ParameterizedTest; | ||
import org.junit.jupiter.params.provider.CsvSource; | ||
import org.junit.jupiter.params.provider.ValueSource; | ||
|
||
import java.util.Arrays; | ||
import java.util.HashSet; | ||
|
||
public class SiteTests { | ||
|
||
private static Site site; | ||
|
||
@BeforeAll | ||
public static void setup() { | ||
site = new Site(101, new HashSet<>(Arrays.asList( | ||
"example.com", | ||
"example.org", | ||
"com.123.Game.App.android", | ||
"123456789" | ||
))); | ||
} | ||
|
||
|
||
@ParameterizedTest | ||
@ValueSource(strings = { | ||
"example.com", | ||
"example.org", | ||
"com.123.Game.App.android", | ||
"123456789", | ||
"EXAMPLE.COM", | ||
"com.123.game.app.android", | ||
}) | ||
public void testAllowDomainOrAppNameSuccess(String domainOrAppName) { | ||
Assertions.assertTrue(site.allowDomainOrAppName(domainOrAppName)); | ||
} | ||
|
||
@ParameterizedTest | ||
@CsvSource({ | ||
"*", | ||
"example", | ||
"example*", | ||
"example.net" | ||
}) | ||
public void testAllowDomainOrAppNameFailure(String domainOrAppName) { | ||
Assertions.assertFalse(site.allowDomainOrAppName(domainOrAppName)); | ||
} | ||
} |