Populating Spring @Value during Unit Test
If possible I would try to write those test without Spring Context. If you create this class in your test without spring, then you have full control over its fields. To set the @value field you can use Springs ReflectionTestUtils – it has a method setField to set private fields. @see JavaDoc: ReflectionTestUtils.setField(java.lang.Object, java.lang.String, java.lang.Object)