use of com.vsct.vboard.parameterFormat.AddNewPinParams in project vboard by voyages-sncf-technologies.
the class NotificationsControllerTest method postPinByAuthor.
public void postPinByAuthor(String[] labels) {
// Impossible to test the addNotificationsFromPin call from this.pinController while mocking this.permission.
// this.pinsController Test. Check if the right method is called with the right arguments, then we test the method called itself with the same arguments.
NotificationsController notificationsControllerSpy = spy(this.notificationsController);
PinsController pinsControllerSpy = new PinsController(jdbcTemplate, pinDAO, userDAO, commentDAO, likeDAO, labelDAO, savedPinDAO, elsClient, uploadsManager, permission, gamificationController, notificationsControllerSpy, proxyConfig);
this.pinsController.deleteAllPins();
pinsControllerSpy.addNewPin(new AddNewPinParams("title", "url", "im", "description", labels, "emailNotifFrom,firstname,lastname"));
verify(notificationsControllerSpy).addNotificationsFromPin(eq(this.pinDAO.findAll().iterator().next().getPinId()), eq("a ajouté une épingle avec un label que vous suivez"));
}
use of com.vsct.vboard.parameterFormat.AddNewPinParams in project vboard by voyages-sncf-technologies.
the class PinsControllerTest method update.
@Test
public void update() throws IOException {
this.pinDAO.save(new Pin("0", "title", "", 0, "", "", "content", "auth", new DateTime()));
String[] labels = { "label" };
ArrayList<Pin> pins = new ArrayList<>();
pins.add(this.pinDAO.findByPinId("0"));
Mockito.doReturn(pins).when(elsClient).searchPinsById("0");
try {
this.pinsController.updatePin(new AddNewPinParams("titleupdate", "url", "imgtype", "contentupdate", labels, "auth"), "notfound");
Assert.fail("Epingle non trouvee, sans erreur");
} catch (VBoardException e) {
}
Assert.assertEquals(this.pinDAO.findByPinId("0").getPinTitle(), "title");
this.pinsController.updatePin(new AddNewPinParams("titleupdate", "url", "imgtype", "contentupdate", labels, "author"), "0");
Pin pin = this.pinDAO.findByPinId("0");
Assert.assertEquals("titleupdate", pin.getPinTitle());
Assert.assertEquals("url", pin.getHrefUrl());
Assert.assertEquals("/pinImg/0.png", pin.getImgType());
Assert.assertEquals("contentupdate", pin.getIndexableTextContent());
Assert.assertEquals("label", pin.getLabels());
Assert.assertEquals("auth", pin.getAuthor());
this.pinsController.updatePin(new AddNewPinParams("titleupdate", "url", null, "contentupdate", labels, "author"), "0");
pin = this.pinDAO.findByPinId("0");
Assert.assertNull(pin.getImgType());
}
Aggregations