### Question:
DrugOrder extends Order { @Override public boolean hasSameOrderableAs(Order otherOrder) { if (!super.hasSameOrderableAs(otherOrder)) { return false; } if (!(otherOrder instanceof DrugOrder)) { return false; } DrugOrder otherDrugOrder = (DrugOrder) otherOrder; if (isNonCodedDrug() || otherDrugOrder.isNonCodedDrug()) { return OpenmrsUtil.nullSafeEqualsIgnoreCase(this.getDrugNonCoded(), otherDrugOrder.getDrugNonCoded()); } return OpenmrsUtil.nullSafeEquals(this.getDrug(), otherDrugOrder.getDrug()); } DrugOrder();  DrugOrder(Integer orderId); @Override DrugOrder copy(); boolean isDrugOrder(); Concept getDoseUnits(); void setDoseUnits(Concept doseUnits); OrderFrequency getFrequency(); void setFrequency(OrderFrequency frequency); Boolean getAsNeeded(); void setAsNeeded(Boolean asNeeded); Double getQuantity(); void setQuantity(Double quantity); Concept getQuantityUnits(); void setQuantityUnits(Concept quantityUnits); Drug getDrug(); void setDrug(Drug drug); String getAsNeededCondition(); void setAsNeededCondition(String asNeededCondition); Concept getRoute(); void setRoute(Concept route); void setDose(Double dose); Double getDose(); Class<? extends DosingInstructions> getDosingType(); void setDosingType(Class<? extends DosingInstructions> dosingType); DosingInstructions getDosingInstructionsInstance(); Integer getNumRefills(); void setNumRefills(Integer numRefills); void setDosingInstructions(String dosingInstructions); String getDosingInstructions(); Integer getDuration(); void setDuration(Integer duration); Concept getDurationUnits(); void setDurationUnits(Concept durationUnits); String getBrandName(); void setBrandName(String brandName); Boolean getDispenseAsWritten(); void setDispenseAsWritten(Boolean dispenseAsWritten); @Override DrugOrder cloneForDiscontinuing(); @Override DrugOrder cloneForRevision(); void setAutoExpireDateBasedOnDuration(); @Override String toString(); void setDosing(DosingInstructions di); @Override boolean hasSameOrderableAs(Order otherOrder); String getDrugNonCoded(); void setDrugNonCoded(String drugNonCoded); boolean isNonCodedDrug(); static final long serialVersionUID; }### Answer:
@Test public void hasSameOrderableAs_shouldReturnFalseIfTheOtherOrderIsNull() { DrugOrder order = new DrugOrder(); order.setConcept(new Concept()); assertFalse(order.hasSameOrderableAs(null)); }
@Test public void hasSameOrderableAs_shouldReturnFalseIfBothDrugsAreNullAndTheConceptsAreDifferent() { DrugOrder order = new DrugOrder(); order.setConcept(new Concept()); DrugOrder otherOrder = new DrugOrder(); otherOrder.setConcept(new Concept()); assertFalse(order.hasSameOrderableAs(otherOrder)); }
@Test public void hasSameOrderableAs_shouldReturnTrueIfBothDrugsAreNullAndTheConceptsMatch() { DrugOrder order = new DrugOrder(); Concept concept = new Concept(); order.setConcept(concept); DrugOrder otherOrder = new DrugOrder(); otherOrder.setConcept(concept); assertTrue(order.hasSameOrderableAs(otherOrder)); }
@Test public void hasSameOrderableAs_shouldReturnTrueIfTheConceptsMatchAndBothDrugNonCodedIsNull() { DrugOrder order = new DrugOrder(); Concept concept = new Concept(); order.setConcept(concept); DrugOrder otherOrder = new DrugOrder(); otherOrder.setConcept(concept); assertTrue(order.hasSameOrderableAs(otherOrder)); }