🎉 Init
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
package dev.dinauer.oidcproxy;
|
||||
|
||||
import dev.dinauer.oidcproxy.startup.SegmentMatcher;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
public class SegmentMatcherTests
|
||||
{
|
||||
@Test
|
||||
void testExactMatch_successful()
|
||||
{
|
||||
List<String> prefix = List.of("api", "products");
|
||||
List<String> candidate = List.of("api", "products");
|
||||
|
||||
Optional<Integer> result = SegmentMatcher.match(prefix, candidate);
|
||||
Assertions.assertTrue(result.isPresent());
|
||||
Assertions.assertEquals(2, result.get());
|
||||
}
|
||||
|
||||
@Test
|
||||
void testExactMatch_failure_01()
|
||||
{
|
||||
List<String> prefix = List.of("api", "products");
|
||||
List<String> candidate = List.of("api", "products", "387483");
|
||||
|
||||
Optional<Integer> result = SegmentMatcher.match(prefix, candidate);
|
||||
Assertions.assertTrue(result.isPresent());
|
||||
Assertions.assertEquals(2, result.get());
|
||||
}
|
||||
|
||||
@Test
|
||||
void testExactMatch_failure_02()
|
||||
{
|
||||
List<String> prefix = List.of("api", "products", "482028");
|
||||
List<String> candidate = List.of("api", "products", "387483");
|
||||
|
||||
Optional<Integer> result = SegmentMatcher.match(prefix, candidate);
|
||||
Assertions.assertTrue(result.isEmpty());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user