1   /*
2    * Copyright 2009 minuteFForts
3    * 
4    * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5    * use this file except in compliance with the License. You may obtain a copy of
6    * the License at
7    * 
8    * http://www.apache.org/licenses/LICENSE-2.0
9    * 
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12   * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13   * License for the specific language governing permissions and limitations under
14   * the License.
15   */
16  package com.minutefforts.test.util.assertion;
17  
18  
19  import static com.minutefforts.test.util.assertion.GoldenMasterFile.goldenMasterFile;
20  import static org.junit.Assert.assertEquals;
21  
22  import org.junit.Test;
23  
24  /**
25   * Unit tests for class {@link GoldenMasterFile}.
26   * 
27   * @author Hans-Joachim Belz
28   */
29  public class GoldenMasterFileTest {
30  
31    
32    /**
33     * Unit Test: Loading a Golden Master from a sample file.
34     */
35    @Test
36    public void testGoldenMasterFile() {
37  
38      assertEquals("This is a Golden Master sample file.\n" //  
39          + "And this is a second line.\n", // 
40          goldenMasterFile(this, "SampleGoldenMaster.txt"));
41  
42      // uncomment to have a peek
43      // System.out.println( goldenMasterFile(this, "SampleGoldenMaster.txt") );
44    }
45    
46    /**
47     * Unit Test: Attempt to load a Golden Master from an unknown file.
48     */
49    @Test(expected=IllegalArgumentException.class)
50    public void testUnknownFile() {
51  
52      goldenMasterFile(this, "UnknownGoldenMaster.txt");
53    }
54  }