/*
 * Copyright (c) 2014 - 2017 the original author or authors.
 *
 * 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.ferstl.depgraph;

import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertSame;

public class GraphFormatTest {

  @Rule
  public ExpectedException expectedException = ExpectedException.none();

  @Test
  public void forNameDot() {
    // arrange
    String name1 = "dot";
    String name2 = "Dot";
    String name3 = "DOT";

    // act
    GraphFormat result1 = GraphFormat.forName(name1);
    GraphFormat result2 = GraphFormat.forName(name2);
    GraphFormat result3 = GraphFormat.forName(name3);

    // assert
    assertSame(GraphFormat.DOT, result1);
    assertSame(GraphFormat.DOT, result2);
    assertSame(GraphFormat.DOT, result3);
  }

  @Test
  public void forNameGml() {
    // arrange
    String name1 = "gml";
    String name2 = "Gml";
    String name3 = "GML";

    // act
    GraphFormat result1 = GraphFormat.forName(name1);
    GraphFormat result2 = GraphFormat.forName(name2);
    GraphFormat result3 = GraphFormat.forName(name3);

    // assert
    assertSame(GraphFormat.GML, result1);
    assertSame(GraphFormat.GML, result2);
    assertSame(GraphFormat.GML, result3);
  }

  @Test
  public void forNameWithUnknownFormat() {
    // arrange
    this.expectedException.expect(IllegalArgumentException.class);
    this.expectedException.expectMessage("unknown_format");

    // act/assert
    GraphFormat.forName("unknown_format");
  }

  @Test
  public void getFileExtension() {
    assertEquals(".dot", GraphFormat.DOT.getFileExtension());
    assertEquals(".gml", GraphFormat.GML.getFileExtension());
  }
}

@@ -1840,32 +1840,947 @@
  result3);%0A  %7D%0A%0A
+  @Test%0A  public void forNamePuml() %7B%0A    // arrange%0A    String name1 = %22puml%22;%0A    String name2 = %22Puml%22;%0A    String name3 = %22PUML%22;%0A%0A    // act%0A    GraphFormat result1 = GraphFormat.forName(name1);%0A    GraphFormat result2 = GraphFormat.forName(name2);%0A    GraphFormat result3 = GraphFormat.forName(name3);%0A%0A    // assert%0A    assertSame(GraphFormat.PUML, result2);%0A    assertSame(GraphFormat.PUML, result1);%0A    assertSame(GraphFormat.PUML, result3);%0A  %7D%0A%0A%0A  @Test%0A  public void forNameJson() %7B%0A    // arrange%0A    String name1 = %22json%22;%0A    String name2 = %22Json%22;%0A    String name3 = %22JSON%22;%0A%0A    // act%0A    GraphFormat result1 = GraphFormat.forName(name1);%0A    GraphFormat result2 = GraphFormat.forName(name2);%0A    GraphFormat result3 = GraphFormat.forName(name3);%0A%0A    // assert%0A    assertSame(GraphFormat.JSON, result2);%0A    assertSame(GraphFormat.JSON, result1);%0A    assertSame(GraphFormat.JSON, result3);%0A  %7D%0A%0A
   @Test%0A  public

Add tests for JSON and PUML