some code samples, various examples of simple modeling ideas and some minor algorithms.

ScrabbleTest.java 1002B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. import static org.junit.Assert.*;
  2. import org.junit.After;
  3. import org.junit.Before;
  4. import org.junit.Test;
  5. import java.io.*;
  6. /**
  7. * The test class ScrabbleTest.
  8. *
  9. * @author (your name)
  10. * @version (a version number or a date)
  11. */
  12. public class ScrabbleTest
  13. {
  14. Scrabble scrabble;
  15. /**
  16. * Default constructor for test class ScrabbleTest
  17. */
  18. public ScrabbleTest()
  19. {
  20. }
  21. /**
  22. * Sets up the test fixture.
  23. *
  24. * Called before every test case method.
  25. */
  26. @Before
  27. public void setUp()
  28. {
  29. scrabble = new Scrabble();
  30. }
  31. /**
  32. * Tears down the test fixture.
  33. *
  34. * Called after every test case method.
  35. */
  36. @After
  37. public void tearDown()
  38. {
  39. }
  40. @Test
  41. public void score(){
  42. //Given, When, Then
  43. int expected = 9;
  44. String word;
  45. word = "worm";
  46. int actual = scrabble.score(word);
  47. assertEquals(expected, actual);
  48. }
  49. }