assertEquals should only be used in tests.  Please add an if conditional that throws an appropriate Exception with message instead.