Package com.jitcaforwin.extended.impl.internal.artist

Examples of com.jitcaforwin.extended.impl.internal.artist.GroupArtistImpl


  public static GroupArtist createGroup(String names, Source source){
    if (!isGroup(names)){
      throw new JitcaUnexpectedError("It was tried to build a group based on an artist's name which is not a group!");
    }
   
    GroupArtist group = new GroupArtistImpl(names, source);
   
    StringBuffer artist = new StringBuffer();
    boolean divider = false;
    for (Token token : Scanner.scan(names)){
      if (token instanceof StringToken){
        artist.append(((StringToken) token).getValue());
        artist.append(" ");
        divider = false;
      } else if (token instanceof DividerToken){
        if (!divider){  // The last token was not a divider
          artist.deleteCharAt(artist.length()-1)// Remove last space
          group.addArtist(artist.toString());
          artist = new StringBuffer(); // Clear String Buffer 
        }
        divider = true;
      }
    }
   
    if (artist.length() > 1){
      artist.deleteCharAt(artist.length() - 1)// Remove last space
      group.addArtist(artist.toString());
    }
   
    return group;
  }
View Full Code Here


  @Test
  public void ConstructorTest(){
    Source sourceMock = this.createSourceMock();
   
    Artist singleArtist = ArtistImpl.create("SingleArtist", sourceMock);
    Artist group = new GroupArtistImpl("Group", sourceMock);
   
    assertFalse(singleArtist.isGroup());
    assertTrue(group.isGroup());
  }
View Full Code Here

    Source sourceMock = this.createSourceMock();
   
    Artist memberOne = ArtistImpl.create("MemberOne", sourceMock);
    Artist memberTwo = ArtistImpl.create("MemberTwo", sourceMock);
   
    GroupArtist group = new GroupArtistImpl("Group", sourceMock);
   
    assertTrue(group.size() == 0);
   
    group.addArtist(memberOne);
    assertTrue(group.size() == 1);
    assertTrue(group.getMembers().contains(memberOne));
   
    group.addArtist(memberTwo);
    assertTrue(group.size() == 2);
    assertTrue(group.getMembers().contains(memberTwo));
   
    group.removeArtist(memberOne);
    assertTrue(group.size() == 1);
    assertTrue(group.getMembers().contains(memberTwo));
    assertFalse(group.getMembers().contains(memberOne));
  }
View Full Code Here

  }
 
  @Test
  public void trackTest(){
    Source sourceMock = this.createSourceMock();
    Artist group = new GroupArtistImpl("Group", sourceMock);
    Artist memberA = ArtistImpl.create("MemberA", sourceMock);
    Artist memberB = ArtistImpl.create("MemberB", sourceMock);
   
    ((GroupArtist) group).addArtist(memberA);
    ((GroupArtist) group).addArtist(memberB);
   
    Track trackMockA = EasyMock.createMock(Track.class);
    group.addTrack(trackMockA);
   
    assertTrue(group.getTracks().contains(trackMockA));
    assertTrue(memberA.getTracks().contains(trackMockA));
    assertTrue(memberB.getTracks().contains(trackMockA));
   
    Track trackMockB = EasyMock.createMock(Track.class);
    group.addTrackAsComposer(trackMockB);
   
    assertTrue(group.getTracksAsComposer().contains(trackMockB));
    assertTrue(memberA.getTracksAsComposer().contains(trackMockB));
    assertTrue(memberB.getTracksAsComposer().contains(trackMockB));
   
  }
View Full Code Here

TOP

Related Classes of com.jitcaforwin.extended.impl.internal.artist.GroupArtistImpl

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.