/*
 * ***********************************************************************
 *
 *  ADOBE CONFIDENTIAL
 *  ___________________
 *
 *  Copyright 2013 Adobe Systems Incorporated
 *  All Rights Reserved.
 *
 *  NOTICE:  All information contained herein is, and remains
 *  the property of Adobe Systems Incorporated and its suppliers,
 *  if any.  The intellectual and technical concepts contained
 *  herein are proprietary to Adobe Systems Incorporated and its
 *  suppliers and are protected by trade secret or copyright law.
 *  Dissemination of this information or reproduction of this material
 *  is strictly forbidden unless prior written permission is obtained
 *  from Adobe Systems Incorporated.
 *
 * ***********************************************************************
 */

package com.adobe.primetime.reference.drm.test;

import android.content.Context;
import android.content.res.Resources;
import android.test.InstrumentationTestCase;

import com.adobe.primetime.reference.R;
import com.adobe.primetime.reference.drm.DRMStrings;
import com.adobe.primetime.reference.drm.DRMStringsRes;

/**
 * Unit tests for the DRMStringResources class.
 * 
 */
public class DRMStringsTest extends InstrumentationTestCase {

	private DRMStrings mDrmStrings;
	private Resources mTargetResources;

	@Override
	protected void setUp() throws Exception {
		Context context = getInstrumentation().getTargetContext();
		mTargetResources = context.getResources();
		mDrmStrings = new DRMStringsRes(context.getPackageName(),
				mTargetResources);

	}

	/**
	 * Test that the default message is returned for an error code with no
	 * specific message
	 */
	public void testBuildDefault() {

		assertEquals(
				"3302 "
						+ mTargetResources
								.getString(R.string.drm_message_default),
				mDrmStrings.buildMessage(3302, 0));
	}

	/**
	 * Test that the specific error message for a code is returned.
	 */
	public void testBuildMessage() {
		assertEquals(
				"3359 " + mTargetResources.getString(R.string.drm_message_3359),
				mDrmStrings.buildMessage(3359, 0));
	}

}
