package com.henriquenfaria.popularmovies;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;

// Activity that hosts DetailsFragment
public class DetailsActivity extends AppCompatActivity {

    private static final String LOG_TAG = DetailsActivity.class.getSimpleName();

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_details);
        if (savedInstanceState == null) {
            Intent intent = getIntent();
            if (intent != null && intent.hasExtra(Constants.EXTRA_MOVIE)) {
                DetailsFragment detailsFragment = DetailsFragment.newInstance((Movie) intent
                        .getParcelableExtra(Constants.EXTRA_MOVIE));
                getSupportFragmentManager().beginTransaction()
                        .add(R.id.details_fragment_container, detailsFragment)
                        .commit();
            }
        }
    }
}

@@ -141,16 +141,41 @@
 ctivity;
+%0Aimport android.util.Log;
 %0A%0A// Act
@@ -1007,24 +1007,206 @@
  .commit();%0A
+            %7D else %7B%0A                Log.d(%22LOG_TAG%22, %22Something went wrong. Intent doesn't have Constants.EXTRA_MOVIE extra. Finishing DetailsActivity.%22);%0A                finish();%0A
             

Add logic to finish DetailsActivity if required extra is missing