@@ -266,4 +266,50 @@ protected String createLocalDate(String dateFormat) {
266266 "<topicmeta><critdates><!--name--><revised modified=\" 2017-12-04\" /></critdates></topicmeta>" , prologFragment );
267267
268268 }
269+
270+ /**
271+ * <p>
272+ * <b>Description:</b> Test the functionality when MAP_ENABLE_UPDATE_ON_SAVE
273+ * option is false and other options are set to true.
274+ * </p>
275+ *
276+ */
277+ @ PrepareForTest ({ PluginWorkspaceProvider .class })
278+ @ Test
279+ public void testUpdateDisable_EXM_43284 () {
280+ Mockito .when (wsOptionsStorage .getOption (OptionKeys .MAP_ENABLE_UPDATE_ON_SAVE , Boolean .TRUE .toString ()))
281+ .thenReturn (Boolean .FALSE .toString ());
282+ Mockito .when (wsOptionsStorage .getOption (OptionKeys .MAP_SET_CREATOR , Boolean .TRUE .toString ()))
283+ .thenReturn (Boolean .TRUE .toString ());
284+ Mockito .when (wsOptionsStorage .getOption (OptionKeys .MAP_SET_CREATED_DATE , Boolean .TRUE .toString ()))
285+ .thenReturn (Boolean .TRUE .toString ());
286+ Mockito .when (wsOptionsStorage .getOption (OptionKeys .MAP_UPDATE_CONTRIBUTOR , Boolean .TRUE .toString ()))
287+ .thenReturn (Boolean .TRUE .toString ());
288+ Mockito .when (wsOptionsStorage .getOption (OptionKeys .MAP_UPDATE_REVISED_DATES , Boolean .TRUE .toString ()))
289+ .thenReturn (Boolean .TRUE .toString ());
290+
291+ PrologContentCreator prologContentCreator = new PrologContentCreator (AUTHOR_NAME , "name" );
292+
293+ // Get the prolog according to settings when document is new.
294+ String prologFragment = prologContentCreator .getPrologFragment (true , DocumentType .MAP );
295+ // The prolog fragment is not generated.
296+ assertNull ("The fragment shouldn't be generated." , prologFragment );
297+
298+ // Get the prolog according to settings when document isn't new.
299+ prologFragment = prologContentCreator .getPrologFragment (false , DocumentType .MAP );
300+ // The prolog fragment is not generated.
301+ assertNull ("The fragment shouldn't be generated." , prologFragment );
302+
303+ // Check the author element from the prolog
304+ String prologAuthorElement = prologContentCreator .getPrologAuthorElement (true , DocumentType .MAP );
305+ assertNull ("The fragment shouldn't be generated." , prologAuthorElement );
306+ prologAuthorElement = prologContentCreator .getPrologAuthorElement (false , DocumentType .MAP );
307+ assertNull ("The fragment shouldn't be generated." , prologAuthorElement );
308+
309+ // Check the date element from the prolog
310+ String dateFragment = prologContentCreator .getDateFragment (true , DocumentType .MAP );
311+ assertNull ("The fragment shouldn't be generated." , dateFragment );
312+ dateFragment = prologContentCreator .getDateFragment (false , DocumentType .TOPIC );
313+ assertNull ("The fragment shouldn't be generated." , dateFragment );
314+ }
269315}
0 commit comments