diff --git a/src/main/java/org/mastodon/util/TreeUtils.java b/src/main/java/org/mastodon/util/TreeUtils.java index 14149a5ac..f046320f6 100644 --- a/src/main/java/org/mastodon/util/TreeUtils.java +++ b/src/main/java/org/mastodon/util/TreeUtils.java @@ -249,7 +249,9 @@ public static int getMinTimepoint( final Model model ) } /** - * Gets the maximum timepoint in the given {@link Model} at which at least one {@link Spot} exists in the Model. + * Gets the maximum time point in the given {@link Model} at which at least one {@link Spot} exists in the Model. + *
+ * If the model is empty, returns 0. * @param model the {@link Model} * @return the timepoint */ diff --git a/src/test/java/org/mastodon/util/TreeUtilsTest.java b/src/test/java/org/mastodon/util/TreeUtilsTest.java index aefbdec85..b3784ae0e 100644 --- a/src/test/java/org/mastodon/util/TreeUtilsTest.java +++ b/src/test/java/org/mastodon/util/TreeUtilsTest.java @@ -191,6 +191,7 @@ public void testGetMaxTimepoint() { assertEquals( 3, TreeUtils.getMaxTimepoint( new ExampleGraph1().getModel() ) ); assertEquals( 7, TreeUtils.getMaxTimepoint( new ExampleGraph2().getModel() ) ); + assertEquals( 0, TreeUtils.getMaxTimepoint( new Model() ) ); } @Test