Example usage for org.springframework.data.mongodb.core.mapping.event BeforeConvertEvent BeforeConvertEvent

List of usage examples for org.springframework.data.mongodb.core.mapping.event BeforeConvertEvent BeforeConvertEvent

Introduction

In this page you can find the example usage for org.springframework.data.mongodb.core.mapping.event BeforeConvertEvent BeforeConvertEvent.

Prototype

public BeforeConvertEvent(T source, String collectionName) 

Source Link

Document

Creates new BeforeConvertEvent .

Usage

From source file:com.epam.ta.reportportal.triggers.HashFuctionTest.java

@Test
public void checkHashFunction() {
    String testPassword = "value to encode";
    EncodePasswordTrigger trigger = new EncodePasswordTrigger();
    User user = new User();
    user.setPassword(testPassword);/*from w w w.j  a v a  2s . c  o  m*/

    trigger.onBeforeConvert(new BeforeConvertEvent<>(user, null));

    Assert.assertEquals(user.getPassword(), new Md5PasswordEncoder().encodePassword(testPassword, null));
}