Play { @Override public String toString() { final StringBuilder buffer = new StringBuilder(); if (!announcements.isEmpty()) { buffer.append("an="); for (int index = 0; index < announcements.size(); index++) { buffer.append(announcements.get(index)); if (index < announcements.size() - 1) { buffer.append(";"); } } if (iterations > 0) { buffer.append(" "); buffer.append("it=").append(iterations); } } return buffer.toString(); } Play(final List<URI> announcements, final int iterations);  Play(final URI announcement, final int iterations); List<URI> announcements(); int iterations(); @Override String toString();  }
@Test public void testFormatting() { final List<URI> announcements = new ArrayList<URI>(); announcements.add(URI.create("hello.wav")); final Play play = new Play(announcements, 1); final String result = play.toString(); assertTrue("an=hello.wav it=1".equals(result)); System.out.println("Signal Parameters: " + result + "\n"); }
@Test public void testFormattingWithMultipleAnnouncements() { final List<URI> announcements = new ArrayList<URI>(); announcements.add(URI.create("hello.wav")); announcements.add(URI.create("world.wav")); final Play play = new Play(announcements, 1); final String result = play.toString(); assertTrue("an=hello.wav;world.wav it=1".equals(result)); System.out.println("Signal Parameters: " + result + "\n"); }
@Test public void testFormattingWithNoAnnouncements() { final List<URI> announcements = new ArrayList<URI>(); final Play play = new Play(announcements, 1); final String result = play.toString(); assertTrue(result.isEmpty()); }