diff --git a/src/main/java/net/sf/mpxj/ProjectFile.java b/src/main/java/net/sf/mpxj/ProjectFile.java index 92bb24a11a..7643ef6f05 100644 --- a/src/main/java/net/sf/mpxj/ProjectFile.java +++ b/src/main/java/net/sf/mpxj/ProjectFile.java @@ -35,7 +35,6 @@ import java.util.Objects; import java.util.Set; import java.util.stream.Collectors; -import java.util.stream.IntStream; import java.util.stream.Stream; import net.sf.mpxj.common.NumberHelper; diff --git a/src/main/java/net/sf/mpxj/explorer/ProjectExplorer.java b/src/main/java/net/sf/mpxj/explorer/ProjectExplorer.java index e6ba86e496..92eb26f39a 100644 --- a/src/main/java/net/sf/mpxj/explorer/ProjectExplorer.java +++ b/src/main/java/net/sf/mpxj/explorer/ProjectExplorer.java @@ -45,7 +45,6 @@ import com.jgoodies.binding.beans.PropertyAdapter; -import net.sf.mpxj.MPXJException; import net.sf.mpxj.ProjectFile; import net.sf.mpxj.primavera.PrimaveraPMFileReader; import net.sf.mpxj.primavera.PrimaveraXERFileReader; @@ -278,7 +277,7 @@ private void openAll(File file) { updateAndSaveRecents(file); - try (UniversalProjectReader.ProjectReaderProxy proxy = new UniversalProjectReader().getProjectReaderProxy(file);) + try (UniversalProjectReader.ProjectReaderProxy proxy = new UniversalProjectReader().getProjectReaderProxy(file)) { if (proxy == null) { diff --git a/src/main/java/net/sf/mpxj/primavera/PrimaveraPMProjectWriter.java b/src/main/java/net/sf/mpxj/primavera/PrimaveraPMProjectWriter.java index 2e9be66db3..c65b8f9b0a 100644 --- a/src/main/java/net/sf/mpxj/primavera/PrimaveraPMProjectWriter.java +++ b/src/main/java/net/sf/mpxj/primavera/PrimaveraPMProjectWriter.java @@ -29,7 +29,6 @@ import java.util.ArrayList; import java.util.Comparator; -import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; diff --git a/src/test/java/net/sf/mpxj/junit/RateHelperTest.java b/src/test/java/net/sf/mpxj/junit/RateHelperTest.java index 7f4b675828..9797002394 100644 --- a/src/test/java/net/sf/mpxj/junit/RateHelperTest.java +++ b/src/test/java/net/sf/mpxj/junit/RateHelperTest.java @@ -42,12 +42,12 @@ public class RateHelperTest ProjectFile file = new ProjectFile(); file.setDefaultCalendar(file.addDefaultBaseCalendar()); - Assert.assertEquals(RateHelper.convertToHours(file.getProjectProperties(), new Rate(1, TimeUnit.MINUTES)), 60, 0.0); - Assert.assertEquals(RateHelper.convertToHours(file.getProjectProperties(), new Rate(1, TimeUnit.HOURS)), 1, 0.0); - Assert.assertEquals(RateHelper.convertToHours(file.getProjectProperties(), new Rate(8, TimeUnit.DAYS)), 1, 0.0); - Assert.assertEquals(RateHelper.convertToHours(file.getProjectProperties(), new Rate(40, TimeUnit.WEEKS)), 1, 0.0); - Assert.assertEquals(RateHelper.convertToHours(file.getProjectProperties(), new Rate(160, TimeUnit.MONTHS)), 1, 0.0); - Assert.assertEquals(RateHelper.convertToHours(file.getProjectProperties(), new Rate(2080, TimeUnit.YEARS)), 1, 0.0); + Assert.assertEquals(60, RateHelper.convertToHours(file.getProjectProperties(), new Rate(1, TimeUnit.MINUTES)), 0.0); + Assert.assertEquals(1, RateHelper.convertToHours(file.getProjectProperties(), new Rate(1, TimeUnit.HOURS)), 0.0); + Assert.assertEquals(1, RateHelper.convertToHours(file.getProjectProperties(), new Rate(8, TimeUnit.DAYS)), 0.0); + Assert.assertEquals(1, RateHelper.convertToHours(file.getProjectProperties(), new Rate(40, TimeUnit.WEEKS)), 0.0); + Assert.assertEquals(1, RateHelper.convertToHours(file.getProjectProperties(), new Rate(160, TimeUnit.MONTHS)), 0.0); + Assert.assertEquals(1, RateHelper.convertToHours(file.getProjectProperties(), new Rate(2080, TimeUnit.YEARS)), 0.0); } /** @@ -58,11 +58,11 @@ public class RateHelperTest ProjectFile file = new ProjectFile(); file.setDefaultCalendar(file.addDefaultBaseCalendar()); - Assert.assertEquals(RateHelper.convertFromHours(file.getProjectProperties(), new Rate(60, TimeUnit.HOURS), TimeUnit.MINUTES).getAmount(), 1, 0.0); - Assert.assertEquals(RateHelper.convertFromHours(file.getProjectProperties(), new Rate(1, TimeUnit.HOURS), TimeUnit.HOURS).getAmount(), 1, 0.0); - Assert.assertEquals(RateHelper.convertFromHours(file.getProjectProperties(), new Rate(1, TimeUnit.HOURS), TimeUnit.DAYS).getAmount(), 8, 0.0); - Assert.assertEquals(RateHelper.convertFromHours(file.getProjectProperties(), new Rate(1, TimeUnit.HOURS), TimeUnit.WEEKS).getAmount(), 40, 0.0); - Assert.assertEquals(RateHelper.convertFromHours(file.getProjectProperties(), new Rate(1, TimeUnit.HOURS), TimeUnit.MONTHS).getAmount(), 160, 0.0); - Assert.assertEquals(RateHelper.convertFromHours(file.getProjectProperties(), new Rate(1, TimeUnit.HOURS), TimeUnit.YEARS).getAmount(), 2080, 0.0); + Assert.assertEquals(1, RateHelper.convertFromHours(file.getProjectProperties(), new Rate(60, TimeUnit.HOURS), TimeUnit.MINUTES).getAmount(), 0.0); + Assert.assertEquals(1, RateHelper.convertFromHours(file.getProjectProperties(), new Rate(1, TimeUnit.HOURS), TimeUnit.HOURS).getAmount(), 0.0); + Assert.assertEquals(8, RateHelper.convertFromHours(file.getProjectProperties(), new Rate(1, TimeUnit.HOURS), TimeUnit.DAYS).getAmount(), 0.0); + Assert.assertEquals(40, RateHelper.convertFromHours(file.getProjectProperties(), new Rate(1, TimeUnit.HOURS), TimeUnit.WEEKS).getAmount(), 0.0); + Assert.assertEquals(160, RateHelper.convertFromHours(file.getProjectProperties(), new Rate(1, TimeUnit.HOURS), TimeUnit.MONTHS).getAmount(), 0.0); + Assert.assertEquals(2080, RateHelper.convertFromHours(file.getProjectProperties(), new Rate(1, TimeUnit.HOURS), TimeUnit.YEARS).getAmount(), 0.0); } } diff --git a/src/test/java/net/sf/mpxj/junit/XerRelationshipLagCalendarTest.java b/src/test/java/net/sf/mpxj/junit/XerRelationshipLagCalendarTest.java index 40e13e30dd..7cb602f49f 100644 --- a/src/test/java/net/sf/mpxj/junit/XerRelationshipLagCalendarTest.java +++ b/src/test/java/net/sf/mpxj/junit/XerRelationshipLagCalendarTest.java @@ -40,7 +40,7 @@ public class XerRelationshipLagCalendarTest @Test public void testProjectDefaultCalendar() throws Exception { ProjectFile xml = new PrimaveraXERFileReader().read(MpxjTestData.filePath("ProjectDefaultCalendar.xer")); - assertEquals(xml.getProjectProperties().getRelationshipLagCalendar(), RelationshipLagCalendar.PROJECT_DEFAULT); + assertEquals(RelationshipLagCalendar.PROJECT_DEFAULT, xml.getProjectProperties().getRelationshipLagCalendar()); } /** @@ -49,7 +49,7 @@ public class XerRelationshipLagCalendarTest @Test public void testPredecessorCalendar() throws Exception { ProjectFile xml = new PrimaveraXERFileReader().read(MpxjTestData.filePath("PredecessorCalendar.xer")); - assertEquals(xml.getProjectProperties().getRelationshipLagCalendar(), RelationshipLagCalendar.PREDECESSOR); + assertEquals(RelationshipLagCalendar.PREDECESSOR, xml.getProjectProperties().getRelationshipLagCalendar()); } /** @@ -58,7 +58,7 @@ public class XerRelationshipLagCalendarTest @Test public void testSuccessorCalendar() throws Exception { ProjectFile xml = new PrimaveraXERFileReader().read(MpxjTestData.filePath("SuccessorCalendar.xer")); - assertEquals(xml.getProjectProperties().getRelationshipLagCalendar(), RelationshipLagCalendar.SUCCESSOR); + assertEquals(RelationshipLagCalendar.SUCCESSOR, xml.getProjectProperties().getRelationshipLagCalendar()); } /** @@ -67,6 +67,6 @@ public class XerRelationshipLagCalendarTest @Test public void testTwentyFourHourCalendar() throws Exception { ProjectFile xml = new PrimaveraXERFileReader().read(MpxjTestData.filePath("TwentyFourHourCalendar.xer")); - assertEquals(xml.getProjectProperties().getRelationshipLagCalendar(), RelationshipLagCalendar.TWENTY_FOUR_HOUR); + assertEquals(RelationshipLagCalendar.TWENTY_FOUR_HOUR, xml.getProjectProperties().getRelationshipLagCalendar()); } } diff --git a/src/test/java/net/sf/mpxj/junit/XmlRelationshipLagCalendarTest.java b/src/test/java/net/sf/mpxj/junit/XmlRelationshipLagCalendarTest.java index b4655e5d83..9d5363a47c 100644 --- a/src/test/java/net/sf/mpxj/junit/XmlRelationshipLagCalendarTest.java +++ b/src/test/java/net/sf/mpxj/junit/XmlRelationshipLagCalendarTest.java @@ -40,7 +40,7 @@ public class XmlRelationshipLagCalendarTest @Test public void testProjectDefaultCalendar() throws Exception { ProjectFile xml = new PrimaveraPMFileReader().read(MpxjTestData.filePath("ProjectDefaultCalendar.xml")); - assertEquals(xml.getProjectProperties().getRelationshipLagCalendar(), RelationshipLagCalendar.PROJECT_DEFAULT); + assertEquals(RelationshipLagCalendar.PROJECT_DEFAULT, xml.getProjectProperties().getRelationshipLagCalendar()); } /** @@ -49,7 +49,7 @@ public class XmlRelationshipLagCalendarTest @Test public void testPredecessorCalendar() throws Exception { ProjectFile xml = new PrimaveraPMFileReader().read(MpxjTestData.filePath("PredecessorCalendar.xml")); - assertEquals(xml.getProjectProperties().getRelationshipLagCalendar(), RelationshipLagCalendar.PREDECESSOR); + assertEquals(RelationshipLagCalendar.PREDECESSOR, xml.getProjectProperties().getRelationshipLagCalendar()); } /** @@ -58,7 +58,7 @@ public class XmlRelationshipLagCalendarTest @Test public void testSuccessorCalendar() throws Exception { ProjectFile xml = new PrimaveraPMFileReader().read(MpxjTestData.filePath("SuccessorCalendar.xml")); - assertEquals(xml.getProjectProperties().getRelationshipLagCalendar(), RelationshipLagCalendar.SUCCESSOR); + assertEquals(RelationshipLagCalendar.SUCCESSOR, xml.getProjectProperties().getRelationshipLagCalendar()); } /** @@ -67,6 +67,6 @@ public class XmlRelationshipLagCalendarTest @Test public void testTwentyFourHourCalendar() throws Exception { ProjectFile xml = new PrimaveraPMFileReader().read(MpxjTestData.filePath("TwentyFourHourCalendar.xml")); - assertEquals(xml.getProjectProperties().getRelationshipLagCalendar(), RelationshipLagCalendar.TWENTY_FOUR_HOUR); + assertEquals(RelationshipLagCalendar.TWENTY_FOUR_HOUR, xml.getProjectProperties().getRelationshipLagCalendar()); } } diff --git a/src/test/java/net/sf/mpxj/junit/legacy/BasicTest.java b/src/test/java/net/sf/mpxj/junit/legacy/BasicTest.java index 6d66cf95e5..1057d5e559 100644 --- a/src/test/java/net/sf/mpxj/junit/legacy/BasicTest.java +++ b/src/test/java/net/sf/mpxj/junit/legacy/BasicTest.java @@ -255,10 +255,10 @@ public class BasicTest task1.addTask(); List children = task1.getChildTasks(); - assertEquals(children.size(), 2); + assertEquals(2, children.size()); List toplevel = file.getChildTasks(); - assertEquals(toplevel.size(), 1); + assertEquals(1, toplevel.size()); } /**