use of nl.basjes.parse.useragent.analyze.InvalidParserConfigurationException in project yauaa by nielsbasjes.
the class TestAnnotationSystemAnonymous method testWrongTypeParameters2.
// ----------------------------------------------------------------
@Test
void testWrongTypeParameters2() {
InvalidParserConfigurationException exception = assertThrows(InvalidParserConfigurationException.class, () -> record = new MyErrorMapper() {
// Called via the annotation
@SuppressWarnings("unused")
@YauaaField("DeviceClass")
public void wrongSetter(TestRecord testRecord, Double value) {
fail("May NEVER call this method");
}
}.enrich(record));
assertTrue(exception.getMessage().contains("the method [wrongSetter] " + "has been annotated with YauaaField but it has the wrong method signature. It must look like " + "[ public void wrongSetter(TestRecord record, String value) ]"));
}
use of nl.basjes.parse.useragent.analyze.InvalidParserConfigurationException in project yauaa by nielsbasjes.
the class TestAnnotationSystemAnonymous method testTooManyParameters.
// ----------------------------------------------------------------
@Test
void testTooManyParameters() {
InvalidParserConfigurationException exception = assertThrows(InvalidParserConfigurationException.class, () -> record = new MyErrorMapper() {
// Called via the annotation
@SuppressWarnings("unused")
@YauaaField("DeviceClass")
public void wrongSetter(TestRecord testRecord, String value, String extra) {
fail("May NEVER call this method");
}
}.enrich(record));
assertTrue(exception.getMessage().contains("the method [wrongSetter] " + "has been annotated with YauaaField but it has the wrong method signature. It must look like " + "[ public void wrongSetter(TestRecord record, String value) ]"));
}
use of nl.basjes.parse.useragent.analyze.InvalidParserConfigurationException in project yauaa by nielsbasjes.
the class TestAnnotationSystemAnonymous method testInaccessibleSetter.
// ----------------------------------------------------------------
@Test
void testInaccessibleSetter() {
InvalidParserConfigurationException exception = assertThrows(InvalidParserConfigurationException.class, () -> record = new MyErrorMapper() {
// Called via the annotation
@SuppressWarnings("unused")
@YauaaField("DeviceClass")
private void inaccessibleSetter(TestRecord testRecord, String value) {
fail("May NEVER call this method");
}
}.enrich(record));
assertEquals("Method annotated with YauaaField is not public: inaccessibleSetter", exception.getMessage());
}
use of nl.basjes.parse.useragent.analyze.InvalidParserConfigurationException in project yauaa by nielsbasjes.
the class TestAnnotationSystemAnonymous method testWrongReturnType.
// ----------------------------------------------------------------
@Test
void testWrongReturnType() {
InvalidParserConfigurationException exception = assertThrows(InvalidParserConfigurationException.class, () -> record = new MyErrorMapper() {
// Called via the annotation
@SuppressWarnings({ "unused", "SameReturnValue" })
@YauaaField("DeviceClass")
public boolean wrongSetter(TestRecord testRecord, Double value) {
fail("May NEVER call this method");
return false;
}
}.enrich(record));
assertTrue(exception.getMessage().contains("the method [wrongSetter] " + "has been annotated with YauaaField but it has the wrong method signature. It must look like " + "[ public void wrongSetter(TestRecord record, String value) ]"));
}
use of nl.basjes.parse.useragent.analyze.InvalidParserConfigurationException in project yauaa by nielsbasjes.
the class TestAnnotationSystemAnonymous method testWrongTypeParameters1.
// ----------------------------------------------------------------
@Test
void testWrongTypeParameters1() {
InvalidParserConfigurationException exception = assertThrows(InvalidParserConfigurationException.class, () -> record = new MyErrorMapper() {
// Called via the annotation
@SuppressWarnings("unused")
@YauaaField("DeviceClass")
public void wrongSetter(String string, String value) {
fail("May NEVER call this method");
}
}.enrich(record));
assertTrue(exception.getMessage().contains("the method [wrongSetter] " + "has been annotated with YauaaField but it has the wrong method signature. It must look like " + "[ public void wrongSetter(TestRecord record, String value) ]"));
}
Aggregations