001 /** 002 * This is part of HW2: Environment Setup and Java Introduction for CSE 331. 003 */ 004 package hw2.test; 005 import hw2.*; 006 007 import org.junit.Test; 008 import static org.junit.Assert.*; 009 010 /** 011 * HolaWorldTest is a simple test of the HolaWorld class that you 012 * are to fix. This test just makes sure that the program 013 * does not crash and that the correct greeting is printed. 014 */ 015 public class HolaWorldTest { 016 017 /** 018 * Tests that HolaWorld does not crash 019 */ 020 @Test 021 public void testCrash() { 022 /* Any exception thrown will be caught by JUnit. */ 023 HolaWorld.main(new String[0]); 024 } 025 026 /** 027 * Tests that the HolaWorld greeting is correct. 028 */ 029 @Test 030 public void testGreeting() { 031 HolaWorld world = new HolaWorld(); 032 assertEquals(HolaWorld.spanishGreeting, world.getGreeting()); 033 } 034 035 036 }