sbmlteam / jsbml

JSBML is a community-driven project to create a free, open-source, pure Java™ library for reading, writing, and manipulating SBML files (the Systems Biology Markup Language) and data streams. It is an alternative to the mixed Java/native code-based interface provided in libSBML.
https://sbml.org/software/jsbml/
GNU Lesser General Public License v2.1
37 stars 24 forks source link

Removing objectives from a model is not sensitive for removal of the active objective #250

Open Schmoho opened 2 years ago

Schmoho commented 2 years ago

Test to reproduce:

   @Test
    public void test() {
        var m = new Model(3,2);
        var fbcPlugin = (FBCModelPlugin) m.getPlugin(FBCConstants.shortLabel);

        var o1 = fbcPlugin.createObjective("obj1");
        fbcPlugin.setActiveObjective(o1);

        fbcPlugin.getListOfObjectives().removeAll(fbcPlugin.getListOfObjectives());

        assertTrue(fbcPlugin.isSetActiveObjective());
        assertEquals("obj1", fbcPlugin.getActiveObjective());
        assertEquals(0, fbcPlugin.getObjectiveCount());
    }