File { public boolean setCost(double cost) { return attribute.setCost(cost); } File(final String fileName, final int fileSize);  File(final File file); protected  File(final File file, final boolean masterCopy); static boolean isValid(final String fileName); static boolean isValid(final File file); File makeReplica(); File makeMasterCopy(); FileAttribute getAttribute(); int getAttributeSize(); String getName(); final void setName(String name); boolean setOwnerName(String name); String getOwnerName(); int getSize(); int getSizeInByte(); boolean setSize(int fileSize); boolean setUpdateTime(double time); double getLastUpdateTime(); boolean setRegistrationID(int id); long getRegistrationID(); boolean setType(int type); int getType(); boolean setChecksum(int checksum); int getChecksum(); boolean setCost(double cost); double getCost(); long getCreationTime(); boolean isRegistered(); boolean isMasterCopy(); void setMasterCopy(boolean masterCopy); boolean isDeleted(); void setDeleted(boolean deleted); boolean setTransactionTime(double time); double getTransactionTime(); @Override String toString(); Datacenter getDatacenter(); final File setDatacenter(Datacenter datacenter); static final int NOT_REGISTERED; static final int TYPE_UNKNOWN; }
@Test public void testSetCost() { final double cost = 10; final File instance = createFile(); assertTrue(instance.setCost(cost)); assertEquals(cost, instance.getCost()); assertFalse(instance.setCost(-1)); final double zero = 0; assertTrue(instance.setCost(zero)); assertEquals(zero, instance.getCost()); final double newCost = 20; assertTrue(instance.setCost(newCost)); assertEquals(newCost, instance.getCost()); }