/*
 * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
 * or more contributor license agreements. Licensed under the Elastic License;
 * you may not use this file except in compliance with the Elastic License.
 */
package org.elasticsearch.xpack.ml.job.messages;

import org.elasticsearch.test.ESTestCase;

public class MessagesTests extends ESTestCase {

    public void testGetMessage_NoFormatArgs () {
        assertEquals(Messages.DATAFEED_CONFIG_CANNOT_USE_SCRIPT_FIELDS_WITH_AGGS,
                Messages.getMessage(Messages.DATAFEED_CONFIG_CANNOT_USE_SCRIPT_FIELDS_WITH_AGGS));
    }

    public void testGetMessage_WithFormatStrings()  {
        String formattedMessage = Messages.getMessage(Messages.DATAFEED_CONFIG_INVALID_OPTION_VALUE, "field-name", "field-value");
        assertEquals("Invalid field-name value 'field-value' in datafeed configuration", formattedMessage);

        formattedMessage = Messages.getMessage(Messages.JOB_AUDIT_SNAPSHOT_DELETED, "foo-job");
        assertEquals("Job model snapshot 'foo-job' deleted", formattedMessage);
    }
}
