use of nl.basjes.parse.useragent.calculate.ConcatNONDuplicatedCalculator in project yauaa by nielsbasjes.
the class TestCalculators method testFieldAgentNameVersionFallback.
@Test
void testFieldAgentNameVersionFallback() {
MutableUserAgent userAgent = new MutableUserAgent();
userAgent.setForced(UserAgent.DEVICE_BRAND, "some_thing", 1);
userAgent.setForced(AGENT_VERSION, "1.2.3", 1);
new CalculateDeviceBrand().calculate(userAgent);
new CalculateAgentName().calculate(userAgent);
new MajorVersionCalculator(AGENT_VERSION_MAJOR, AGENT_VERSION).calculate(userAgent);
new ConcatNONDuplicatedCalculator(AGENT_NAME_VERSION, AGENT_NAME, AGENT_VERSION).calculate(userAgent);
new ConcatNONDuplicatedCalculator(AGENT_NAME_VERSION_MAJOR, AGENT_NAME, AGENT_VERSION_MAJOR).calculate(userAgent);
assertEquals("Some_Thing", userAgent.getValue(DEVICE_BRAND));
assertEquals("Some_Thing", userAgent.getValue(AGENT_NAME));
assertEquals("Some_Thing 1.2.3", userAgent.getValue(AGENT_NAME_VERSION));
assertEquals("1", userAgent.getValue(AGENT_VERSION_MAJOR));
assertEquals("Some_Thing 1", userAgent.getValue(AGENT_NAME_VERSION_MAJOR));
}
Aggregations