From fa8c6e14b3f87407ea5805e35697acc4d93a8007 Mon Sep 17 00:00:00 2001 From: Clyhtsuriva Date: Sun, 27 Jun 2021 12:43:28 +0200 Subject: PlayList class covered at 84%. --- target/site/jacoco/musichub.business/PlayList.html | 2 +- .../jacoco/musichub.business/PlayList.java.html | 92 +++++++++++----------- target/site/jacoco/musichub.business/index.html | 2 +- .../jacoco/musichub.business/index.source.html | 2 +- 4 files changed, 49 insertions(+), 49 deletions(-) (limited to 'target/site/jacoco/musichub.business') diff --git a/target/site/jacoco/musichub.business/PlayList.html b/target/site/jacoco/musichub.business/PlayList.html index ae17a14..74681b8 100644 --- a/target/site/jacoco/musichub.business/PlayList.html +++ b/target/site/jacoco/musichub.business/PlayList.html @@ -1 +1 @@ -PlayList

PlayList

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total202 of 2020 %14 of 140 %1414535377
PlayList(Element)880 %120 %77232311
createXMLElement(Document, Element)750 %20 %22161611
PlayList(String)140 %n/a115511
PlayList(String, String, ArrayList)130 %n/a115511
addElement(UUID)60 %n/a112211
getElements()30 %n/a111111
getTitle()30 %n/a111111
\ No newline at end of file +PlayList

PlayList

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethods
Total32 of 20284 %5 of 1464 %51495307
createXMLElement(Document, Element)205573 %1150 %1241601
PlayList(Element)127686 %4866 %4752301
PlayList(String)14100 %n/a010501
PlayList(String, String, ArrayList)13100 %n/a010501
addElement(UUID)6100 %n/a010201
getElements()3100 %n/a010101
getTitle()3100 %n/a010101
\ No newline at end of file diff --git a/target/site/jacoco/musichub.business/PlayList.java.html b/target/site/jacoco/musichub.business/PlayList.java.html index 6a45004..3c1eb72 100644 --- a/target/site/jacoco/musichub.business/PlayList.java.html +++ b/target/site/jacoco/musichub.business/PlayList.java.html @@ -13,89 +13,89 @@ public class PlayList { private final UUID uuid; private ArrayList<UUID> elementUUIDs; - public PlayList(String title, String id, ArrayList<UUID> elementUUIDs) { - this.title = title; - this.uuid = UUID.fromString(id); - this.elementUUIDs = elementUUIDs; - } - - public PlayList(String title) { - this.title = title; - this.uuid = UUID.randomUUID(); - this.elementUUIDs = new ArrayList<>(); - } - - public PlayList(Element xmlElement) { + public PlayList(String title, String id, ArrayList<UUID> elementUUIDs) { + this.title = title; + this.uuid = UUID.fromString(id); + this.elementUUIDs = elementUUIDs; + } + + public PlayList(String title) { + this.title = title; + this.uuid = UUID.randomUUID(); + this.elementUUIDs = new ArrayList<>(); + } + + public PlayList(Element xmlElement) { { - this.title = xmlElement.getElementsByTagName("title").item(0).getTextContent(); + this.title = xmlElement.getElementsByTagName("title").item(0).getTextContent(); - String uuid = null; + String uuid = null; try { - uuid = xmlElement.getElementsByTagName("UUID").item(0).getTextContent(); + uuid = xmlElement.getElementsByTagName("UUID").item(0).getTextContent(); } catch (Exception ex) { System.out.println("Empty playlist UUID, will create a new one"); - } - if ((uuid == null) || (uuid.isEmpty())) + } + if ((uuid == null) || (uuid.isEmpty())) this.uuid = UUID.randomUUID(); - else this.uuid = UUID.fromString(uuid); + else this.uuid = UUID.fromString(uuid); //parse list of elements: - Node elementsElement = xmlElement.getElementsByTagName("elements").item(0); - NodeList elementUUIDNodes = elementsElement.getChildNodes(); - if (elementUUIDNodes == null) return; + Node elementsElement = xmlElement.getElementsByTagName("elements").item(0); + NodeList elementUUIDNodes = elementsElement.getChildNodes(); + if (elementUUIDNodes == null) return; - this.elementUUIDs = new ArrayList<>(); + this.elementUUIDs = new ArrayList<>(); - for (int i = 0; i < elementUUIDNodes.getLength(); i++) { - if (elementUUIDNodes.item(i).getNodeType() == Node.ELEMENT_NODE) { - Element elementElement = (Element) elementUUIDNodes.item(i); - if (elementElement.getNodeName().equals("UUID")) { + for (int i = 0; i < elementUUIDNodes.getLength(); i++) { + if (elementUUIDNodes.item(i).getNodeType() == Node.ELEMENT_NODE) { + Element elementElement = (Element) elementUUIDNodes.item(i); + if (elementElement.getNodeName().equals("UUID")) { try { - this.addElement(UUID.fromString(elementElement.getTextContent())); + this.addElement(UUID.fromString(elementElement.getTextContent())); } catch (Exception ex) { ex.printStackTrace(); - } + } } } } } - } + } public void addElement(UUID element) { - elementUUIDs.add(element); - } + elementUUIDs.add(element); + } public ArrayList<UUID> getElements() { - return elementUUIDs; + return elementUUIDs; } public String getTitle() { - return title; + return title; } public void createXMLElement(Document document, Element parentElement) { - Element playlistElement = document.createElement("playlist"); - parentElement.appendChild(playlistElement); + Element playlistElement = document.createElement("playlist"); + parentElement.appendChild(playlistElement); - Element nameElement = document.createElement("title"); - nameElement.appendChild(document.createTextNode(title)); - playlistElement.appendChild(nameElement); + Element nameElement = document.createElement("title"); + nameElement.appendChild(document.createTextNode(title)); + playlistElement.appendChild(nameElement); - Element UUIDElement = document.createElement("UUID"); - UUIDElement.appendChild(document.createTextNode(uuid.toString())); - playlistElement.appendChild(UUIDElement); + Element UUIDElement = document.createElement("UUID"); + UUIDElement.appendChild(document.createTextNode(uuid.toString())); + playlistElement.appendChild(UUIDElement); - Element elementsElement = document.createElement("elements"); - for (UUID currentUUID : this.elementUUIDs) { + Element elementsElement = document.createElement("elements"); + for (UUID currentUUID : this.elementUUIDs) { Element elementUUIDElement = document.createElement("UUID"); elementUUIDElement.appendChild(document.createTextNode(currentUUID.toString())); elementsElement.appendChild(elementUUIDElement); } - playlistElement.appendChild(elementsElement); - } + playlistElement.appendChild(elementsElement); + } } \ No newline at end of file diff --git a/target/site/jacoco/musichub.business/index.html b/target/site/jacoco/musichub.business/index.html index 58b15a0..3178b04 100644 --- a/target/site/jacoco/musichub.business/index.html +++ b/target/site/jacoco/musichub.business/index.html @@ -1 +1 @@ -musichub.business

musichub.business

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethodsMissedClasses
Total1 721 of 2 06316 %161 of 1694 %15217242549966811215
MusicHub8030 %1140 %7979195195222211
Album3300 %140 %161684849911
PlayList2020 %140 %141453537711
AudioBook1640 %100 %171739399911
AudioElement8518168 %9218 %111630724901
Language490 %n/a33663311
Category490 %n/a33663311
SortByAuthor90 %n/a22222211
SortByDate90 %n/a22222211
SortByGenre90 %n/a22222211
NoAlbumFoundException0 %n/a11221111
NoPlayListFoundException0 %n/a11221111
NoElementFoundException0 %n/a11221111
Song105100 %6100 %0120260701
Genre56100 %n/a03060301
\ No newline at end of file +musichub.business

musichub.business

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethodsMissedClasses
Total1 551 of 2 06324 %152 of 16910 %14317238149959811115
MusicHub8030 %1140 %7979195195222211
Album3300 %140 %161684849911
AudioBook1640 %100 %171739399911
AudioElement8518168 %9218 %111630724901
Language490 %n/a33663311
Category490 %n/a33663311
PlayList3217084 %5964 %5149530701
SortByAuthor90 %n/a22222211
SortByDate90 %n/a22222211
SortByGenre90 %n/a22222211
NoAlbumFoundException0 %n/a11221111
NoPlayListFoundException0 %n/a11221111
NoElementFoundException0 %n/a11221111
Song105100 %6100 %0120260701
Genre56100 %n/a03060301
\ No newline at end of file diff --git a/target/site/jacoco/musichub.business/index.source.html b/target/site/jacoco/musichub.business/index.source.html index 5de5f23..967ff25 100644 --- a/target/site/jacoco/musichub.business/index.source.html +++ b/target/site/jacoco/musichub.business/index.source.html @@ -1 +1 @@ -musichub.business

musichub.business

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethodsMissedClasses
Total1 721 of 2 06316 %161 of 1694 %15217242549966811215
MusicHub.java8300 %1140 %8585201201282844
Album.java3300 %140 %161684849911
PlayList.java2020 %140 %141453537711
AudioBook.java1640 %100 %171739399911
AudioElement.java8518168 %9218 %111630724901
Language.java490 %n/a33663311
Category.java490 %n/a33663311
NoAlbumFoundException.java0 %n/a11221111
NoPlayListFoundException.java0 %n/a11221111
NoElementFoundException.java0 %n/a11221111
Song.java105100 %6100 %0120260701
Genre.java56100 %n/a03060301
\ No newline at end of file +musichub.business

musichub.business

ElementMissed InstructionsCov.Missed BranchesCov.MissedCxtyMissedLinesMissedMethodsMissedClasses
Total1 551 of 2 06324 %152 of 16910 %14317238149959811115
MusicHub.java8300 %1140 %8585201201282844
Album.java3300 %140 %161684849911
AudioBook.java1640 %100 %171739399911
AudioElement.java8518168 %9218 %111630724901
Language.java490 %n/a33663311
Category.java490 %n/a33663311
PlayList.java3217084 %5964 %5149530701
NoAlbumFoundException.java0 %n/a11221111
NoPlayListFoundException.java0 %n/a11221111
NoElementFoundException.java0 %n/a11221111
Song.java105100 %6100 %0120260701
Genre.java56100 %n/a03060301
\ No newline at end of file -- cgit v1.2.3