/*
 * 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.assertEquals;
import static org.junit.Assert.assertNotNull;

import org.junit.Before;
import org.junit.Test;

/**
 * Unit tests for {@link Video}.
 */
public class VideoTest {

  private static final String SLUG = "My slug";
  private static final String TITLE = "My title";
  private static final String DESCRIPTION = "My description";
  private static final String IMAGE_URL = "My imageUrl";
  private static final String VIDEO_URL = "My videoUrl";

  private Video.Builder builder;
  private Video video;

  /**
   * {@link #builder} and {@link #video} fields are shared.
   */
  @Before
  public void before() {

    // Given/when (shared)
    builder = new Video.Builder()
        .slug(SLUG)
        .title(TITLE)
        .description(DESCRIPTION)
        .imageUrl(IMAGE_URL)
        .videoUrl(VIDEO_URL);
    video = builder.build();
  }

  @Test
  public void builder_givenValues_whenBuilt_thenVideoHasValues() {

    // Then
    assertNotNull(video);
    assertEquals(0, video.describeContents());
    assertEquals(SLUG, video.getSlug());
    assertEquals(TITLE, video.getTitle());
    assertEquals(DESCRIPTION, video.getDescription());
    assertEquals(IMAGE_URL, video.getImageUrl());
    assertEquals(VIDEO_URL, video.getVideoUrl());
  }

  @Test
  public void toString_whenSlugSet_thenContainsSlug() {

    // When
    String videoToString = video.toString();

    // Then
    assertEquals(String.format("Video{slug=%s}", video.getSlug()), videoToString);
  }
}

@@ -1126,41 +1126,8 @@
 %22;%0A%0A
-  private Video.Builder builder;%0A
   pr
@@ -1161,27 +1161,23 @@
   * 
-%7B@link #builder%7D an
+Creates a share
 d %7B@
@@ -1185,33 +1185,23 @@
 ink 
-#v
+V
 ideo%7D 
-fields are shared
+instance
 .%0A  
@@ -1271,23 +1271,21 @@
 ed)%0A    
-builder
+video
  = new V
@@ -1436,29 +1436,17 @@
 URL)
-;
 %0A    
-video = builder
+    
 .bui

Remove unnecessary builder field