BusLine extends AbstractBusContainer<BusNetwork, BusItinerary> { public boolean addBusItinerary(BusItinerary busItinerary) { if (busItinerary == null) { return false; } if (this.itineraries.indexOf(busItinerary) != -1) { return false; } if (!this.itineraries.add(busItinerary)) { return false; } final boolean isValidItinerary = busItinerary.isValidPrimitive(); busItinerary.setEventFirable(isEventFirable()); busItinerary.setContainer(this); if (isEventFirable()) { fireShapeChanged(new BusChangeEvent(this, BusChangeEventType.ITINERARY_ADDED, busItinerary, this.itineraries.size() - 1, "shape", null, null)); if (!isValidItinerary) { revalidate(); } else { checkPrimitiveValidity(); } } return true; } BusLine(BusNetwork network, String name);  BusLine(UUID id, BusNetwork network, String name);  BusLine(BusNetwork network, String name, AttributeCollection attributeProvider);  BusLine(UUID id, BusNetwork network, String name, AttributeCollection attributeProvider);  BusLine(String name);  BusLine(UUID id, String name);  BusLine(String name, AttributeCollection attributeProvider);  BusLine(UUID id, String name, AttributeCollection attributeProvider);  BusLine(BusNetwork network);  BusLine(UUID id, BusNetwork network);  BusLine(BusNetwork network, AttributeCollection attributeProvider);  BusLine(UUID id, BusNetwork network, AttributeCollection attributeProvider);  BusLine();  BusLine(UUID id);  BusLine(AttributeCollection attributeProvider);  BusLine(UUID id, AttributeCollection attributeProvider); @Override @Pure void toJson(JsonBuffer buffer); static String getFirstFreeBusLineName(BusNetwork network); @Override void rebuild(boolean fireEvents); @Override Class<? extends BusItinerary> getElementType(); @Override BusNetwork getBusNetwork(); @Override void setName(String name); @Override void resetBoundingBox(); @Override Shape2d<?> getShape(); @Pure Path2d toPath2D(); @Pure void toPath2D(Path2d path); @Override int size(); @Override Iterator<BusItinerary> iterator(); boolean addBusItinerary(BusItinerary busItinerary); boolean addBusItinerary(BusItinerary busItinerary, int index); void removeAllBusItineraries(); boolean removeBusItinerary(BusItinerary itinerary); boolean removeBusItinerary(int index); int getBusItineraryCount(); int indexOf(BusItinerary itinerary); @Override int indexInParent(); BusItinerary getBusItineraryAt(int index); BusItinerary getBusItinerary(String name); BusItinerary getBusItinerary(UUID uuid); BusItinerary getBusItinerary(String name, Comparator<String> nameComparator); Iterator<BusItinerary> busItineraryIterator(); Iterable<BusItinerary> busItineraries();  }
@Test public void testIsValidPrimitive() { assertFalse(this.line.isValidPrimitive()); initTest(); assertTrue(this.line.isValidPrimitive()); this.line.addBusItinerary(new BusItinerary()); assertFalse(this.line.isValidPrimitive()); }