backend/restservice/src/test/java/com/plannaplan/security/CasValidatorTest.java

41 lines
1.2 KiB
Java
Raw Normal View History

2020-09-11 13:15:22 +02:00
package com.plannaplan.security;
2020-09-11 14:12:13 +02:00
import static org.junit.jupiter.api.Assertions.assertTrue;
2020-09-11 13:15:22 +02:00
import org.junit.Ignore;
import org.junit.Test;
public class CasValidatorTest {
@Test
@Ignore
public void shouldValidateTicket() {
//you need to privide fresh ticket to make this test pass that's why it is marked as ignored
CasValidator validator = new CasValidator("http://localhost:3000",
"ST-572267-cbgKrcJLd0tdCubeLqdW-cas.amu.edu.pl");
try {
System.out.println(validator.validate());
} catch (Exception e) {
e.printStackTrace();
2020-09-11 14:12:13 +02:00
assertTrue(false);
}
}
@Test
public void shouldNotValidateTicket() {
//you need to privide fresh ticket to make this test pass that's why it is marked as ignored
CasValidator validator = new CasValidator("http://localhost:3000",
"notticket");
try {
assertTrue(validator.validate().trim().equals(""));
}
catch (CasValidationExcepiton e){
assertTrue(true);
}
catch (Exception e) {
e.printStackTrace();
assertTrue(false);
2020-09-11 13:15:22 +02:00
}
}
}