Beispiel #1
0
  /**
   * Test case for the method addLineToLastMeasure(String g) which adds a string/line to the current
   * instance of tablature's last measure. This method is tested by asserting that each added line
   * to equal to the string in the last position of the tablature's measure
   */
  @Test
  public void testAddLineToLastMeasure() {
    assertEquals(test.size(), 0);

    String g = "||*-----<5>-----------<7>----------------------------*||";
    test.addLineToLastMeasure(g);
    assertEquals(test.getMeasures().get(0).getLines().get(0), g);

    g = "||*-----<5>-----------<1>----------------------------*||";
    test.addLineToLastMeasure(g);
    assertEquals(test.getMeasures().get(0).getLines().get(1), g);

    g = "||*-----<5>-----------<3>----------------------------*||";
    test.addLineToLastMeasure(g);
    assertEquals(test.getMeasures().get(0).getLines().get(2), g);

    g = "||*-----<5>-----------<9>----------------------------*||";
    test.addLineToLastMeasure(g);
    assertEquals(test.getMeasures().get(0).getLines().get(3), g);

    g = "||*-----<5>-----------<5>----------------------------*||";
    test.addLineToLastMeasure(g);
    assertEquals(test.getMeasures().get(0).getLines().get(4), g);

    g = "||*-----<5>-----------<6>----------------------------*||";
    test.addLineToLastMeasure(g);
    assertEquals(test.getMeasures().get(0).getLines().get(5), g);

    g = "||*-----<5>-----------<8>----------------------------*||";
    test.addLineToLastMeasure(g);
    assertEquals(test.getMeasures().get(1).getLines().get(0), g);
  }
Beispiel #2
0
  /**
   * Test case for the size() method which returns the current number of measures in Tablature. This
   * method is tested by adding one measure to the tablature and then asserting the size is equal to
   * 1. Another measure is then added and the current size is asserted to be 2
   */
  @Test
  public void testSize() {
    assertEquals(test.size(), 0);

    String g = "||*-----<5>-----------<7>----------------------------*||";

    test.addLineToLastMeasure(g);
    test.addLineToLastMeasure(g);
    test.addLineToLastMeasure(g);
    test.addLineToLastMeasure(g);
    test.addLineToLastMeasure(g);

    assertEquals(test.size(), 1);

    test.addLineToLastMeasure(g);
    test.addLineToLastMeasure(g);

    assertEquals(test.size(), 2);
  }