String albumTitle = "<album title>";
mp3.setID3v2Tag(id3v2);
mp3.setID3v1Tag(id3v1);
mp3.setLyrics3Tag(lyrics3);
mp3.setMp3file(new File(albumTitle));
FilenameTag filename = FilenameTagBuilder.createFilenameTagFromMP3File(mp3);
mp3.setFilenameTag(filename);
AbstractID3v2Frame frame;
AbstractID3v2FrameBody body;
// test nulls;
assertEquals(0, mp3.getUnsynchronizedFragments().size());
// test equals
body = new FrameBodyTALB((byte) 0, albumTitle);
frame = new ID3v2_4Frame(body);
id3v2.setFrame(frame);
assertEquals(0, mp3.getUnsynchronizedFragments().size());
lyrics3.setField(new Lyrics3v2Field(frame));
assertEquals(0, mp3.getUnsynchronizedFragments().size());
id3v1.setAlbum(albumTitle);
assertEquals(0, mp3.getUnsynchronizedFragments().size());
filename.setFrame(frame);
assertEquals(0, mp3.getUnsynchronizedFragments().size());
// test differences
body = new FrameBodyTIT2((byte) 0, "<song title>");
frame = new ID3v2_4Frame();
frame.setBody(body);
filename.setFrame(frame);
assertEquals(0, mp3.getUnsynchronizedFragments().size());
id3v1.setTitle("different");
assertEquals(1, mp3.getUnsynchronizedFragments().size());
id3v1.setTitle("<song title>");
assertEquals(0, mp3.getUnsynchronizedFragments().size());
lyrics3.setField(new Lyrics3v2Field(new FieldBodyETT("different")));
assertEquals(1, mp3.getUnsynchronizedFragments().size());
lyrics3.setField(new Lyrics3v2Field(new FieldBodyETT("<song title>")));
assertEquals(0, mp3.getUnsynchronizedFragments().size());
body = new FrameBodyTIT2((byte) 0, "different");
frame = new ID3v2_4Frame(body);
id3v2.setFrame(frame);
assertEquals(1, mp3.getUnsynchronizedFragments().size());
// test two differences
id3v1.setArtist("<song artist>");
assertEquals(1, mp3.getUnsynchronizedFragments().size());
body = new FrameBodyTPE1((byte) 0, "different");
frame = new ID3v2_4Frame();
frame.setBody(body);
filename.setFrame(frame);
assertEquals(2, mp3.getUnsynchronizedFragments().size());
body = new FrameBodyTPE1((byte) 0, "<song artist>");
frame = new ID3v2_4Frame();
frame.setBody(body);
filename.setFrame(frame);
assertEquals(1, mp3.getUnsynchronizedFragments().size());
lyrics3.setField(new Lyrics3v2Field(new FieldBodyEAR("different")));
assertEquals(2, mp3.getUnsynchronizedFragments().size());
lyrics3.setField(new Lyrics3v2Field(new FieldBodyEAR("<song artist>")));
assertEquals(1, mp3.getUnsynchronizedFragments().size());