/*
 * Copyright 2016 Martin Kamp Jensen
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.github.mkjensen.dml.ondemand;

import static org.junit.Assert.assertNotNull;

import android.view.View;

import com.github.mkjensen.dml.R;
import com.github.mkjensen.dml.test.RobolectricTest;

import org.junit.Before;
import org.junit.Test;
import org.robolectric.Robolectric;

/**
 * Tests for {@link BrowseActivity}.
 */
public class BrowseActivityTest extends RobolectricTest {

  private BrowseActivity browseActivity;

  /**
   * Creates a {@link BrowseActivity} instance.
   */
  @Before
  public void before() {
    browseActivity = Robolectric.buildActivity(BrowseActivity.class)
        .create()
        .get();
  }

  @Test
  public void findViewById_onDemandBrowserFragmentExists() {

    // When
    View browseFragment = browseActivity.findViewById(R.id.ondemand_browse_fragment);

    // Then
    assertNotNull(browseFragment);
  }
}

@@ -684,16 +684,59 @@
 NotNull;
+%0Aimport static org.junit.Assert.assertTrue;
 %0A%0Aimport
@@ -1497,11 +1497,197 @@
 nt);%0A  %7D
+%0A%0A  @Test%0A  public void onSearchRequested_returnsTrue() %7B%0A%0A    // When%0A    boolean searchRequested = browseActivity.onSearchRequested();%0A%0A    // Then%0A    assertTrue(searchRequested);%0A  %7D
 %0A%7D%0A

Add test for onSearchRequested