/*
 * Copyright 2014 Matteo Ceccarello
 * 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 it.unipd.dei.experiment;

import static org.hamcrest.CoreMatchers.*;
import static org.junit.Assert.*;

import clojure.lang.*;
import org.junit.Test;

public class EdnFormatterTest {

  public static final Keyword CLASS = Keyword.intern(null, "class");
  public static final Keyword NAME = Keyword.intern(null, "name");
  public static final Keyword DATE = Keyword.intern(null, "date");
  public static final Keyword NOTES = Keyword.intern(null, "notes");
  public static final Keyword TAGS = Keyword.intern(null, "tags");
  public static final Keyword TABLES = Keyword.intern(null, "tables");

  @Test
  public void testEdn1() {
    Experiment exp = new Experiment("exp-class", "exp-name");
    String edn = EdnFormatter.format(exp);
    Object parsed = RT.readString(edn);

    assertThat(parsed, is(instanceOf(IPersistentMap.class)));

    IPersistentMap expMap = (IPersistentMap) parsed;

    assertEquals(expMap.valAt(CLASS), "exp-class");
    assertEquals(expMap.valAt(NAME), "exp-name");
    assertEquals(expMap.valAt(NOTES), PersistentVector.EMPTY);
    assertEquals(expMap.valAt(TAGS), PersistentArrayMap.EMPTY);
    assertEquals(expMap.valAt(TABLES), PersistentArrayMap.EMPTY);
  }

}

@@ -1793,10 +1793,628 @@
 );%0A  %7D%0A%0A
+  @Test%0A  public void testEdnNotes() %7B%0A    Experiment exp = new Experiment(%22exp-class%22, %22exp-name%22);%0A    exp.note(%22This is a test note%22);%0A%0A    String edn = EdnFormatter.format(exp);%0A    Object parsed = RT.readString(edn);%0A%0A    IPersistentMap expMap = (IPersistentMap) parsed;%0A    IPersistentVector notes = (IPersistentVector) expMap.valAt(NOTES);%0A%0A    assertThat(notes.length(), is(1));%0A    assertThat(notes.nth(0), is(instanceOf(IPersistentVector.class)));%0A    IPersistentVector note = (IPersistentVector) notes.nth(0);%0A    assertThat(note.length(), is(2));%0A    assertEquals(note.nth(1), %22This is a test note%22);%0A  %7D%0A%0A
 %7D%0A

Add one more test