use of nl.basjes.parse.useragent.analyze.InvalidParserConfigurationException in project yauaa by nielsbasjes.
the class TestVersionCollisionChecks method testBadVersion.
@Test
void testBadVersion() {
InvalidParserConfigurationException exception = assertThrows(InvalidParserConfigurationException.class, () -> UserAgentAnalyzer.newBuilder().dropDefaultResources().addResources("classpath*:Versions/BadVersion.yaml").delayInitialization().build());
assertTrue(exception.getMessage().contains("Found unexpected config entry: bad"));
}
use of nl.basjes.parse.useragent.analyze.InvalidParserConfigurationException in project yauaa by nielsbasjes.
the class TestVersionCollisionChecks method testBadVersionNotMap.
@Test
void testBadVersionNotMap() {
InvalidParserConfigurationException exception = assertThrows(InvalidParserConfigurationException.class, () -> UserAgentAnalyzer.newBuilder().dropDefaultResources().addResources("classpath*:Versions/BadVersionNotMap.yaml").delayInitialization().build());
assertTrue(exception.getMessage().contains("The value should be a string but it is a sequence"));
}
use of nl.basjes.parse.useragent.analyze.InvalidParserConfigurationException in project yauaa by nielsbasjes.
the class TestVersionCollisionChecks method testDifferentVersion.
@Test
void testDifferentVersion() {
InvalidParserConfigurationException exception = assertThrows(InvalidParserConfigurationException.class, () -> UserAgentAnalyzer.newBuilder().delayInitialization().addResources("classpath*:Versions/DifferentVersion.yaml").build());
assertTrue(exception.getMessage().contains("Two different Yauaa versions have been loaded:"));
}
use of nl.basjes.parse.useragent.analyze.InvalidParserConfigurationException in project yauaa by nielsbasjes.
the class TestAnnotationBadUsages method testMissingTypeParameter.
@Test
void testMissingTypeParameter() {
InvalidParserConfigurationException exception = assertThrows(InvalidParserConfigurationException.class, MapperWithoutGenericType::new);
assertEquals("Couldn't find the used generic type of the UserAgentAnnotationMapper.", exception.getMessage());
}
use of nl.basjes.parse.useragent.analyze.InvalidParserConfigurationException in project yauaa by nielsbasjes.
the class TestAnnotationBadUsages method testNoInit.
@Test
void testNoInit() {
UserAgentAnnotationAnalyzer<String> userAgentAnalyzer = new UserAgentAnnotationAnalyzer<>();
InvalidParserConfigurationException exception = assertThrows(InvalidParserConfigurationException.class, () -> assertNull(userAgentAnalyzer.map("Foo")));
assertEquals("[Map] The mapper instance is null.", exception.getMessage());
}
Aggregations