use of nl.basjes.parse.useragent.AgentField.MutableAgentField in project yauaa by nielsbasjes.
the class TestUseragent method testCopying.
@Test
void testCopying() {
MutableAgentField origNull = new MutableAgentField(null);
origNull.setValue("One", 1);
// Different default!
MutableAgentField copyNull = new MutableAgentField("Foo");
assertTrue(copyNull.setValue(origNull));
assertEquals("One", copyNull.getValue());
assertEquals(1, copyNull.getConfidence());
copyNull.reset();
// The default should NOT be modified
assertEquals("Foo", copyNull.getValue());
assertEquals(-1, copyNull.getConfidence());
MutableAgentField origFoo = new MutableAgentField("Foo");
origFoo.setValue("Two", 2);
// Different default!
MutableAgentField copyFoo = new MutableAgentField(null);
copyFoo.setValue(origFoo);
assertEquals("Two", copyFoo.getValue());
assertEquals(2, copyFoo.getConfidence());
copyFoo.reset();
// The default should NOT be modified
assertNull(copyFoo.getValue());
assertEquals(-1, copyFoo.getConfidence());
}
Aggregations