Created
February 8, 2011 23:43
-
-
Save ktoso/817547 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package pl.xlab.doc.banana; | |
import com.google.java.contract.Ensures; | |
import com.google.java.contract.Invariant; | |
import com.google.java.contract.Requires; | |
import com.google.java.contract.ThrowEnsures; | |
import pl.xlab.doc.banana.exceptions.NotEnoughBananasException; | |
import java.util.Collection; | |
/** @author Konrad Malawski */ | |
@Invariant("countBananas() >= 0") | |
public interface BananaService { | |
@Requires({ | |
"amount > 0" | |
}) | |
@Ensures({ | |
"countBananas() == old(countBananas()) - amount", | |
"result != null" | |
}) | |
@ThrowEnsures({ | |
"NotEnoughBananasException", "countBananas() == 0" | |
}) | |
public Collection<Banana> requestBananas(int amount) throws NotEnoughBananasException; | |
@Ensures("old(countBananas()) == countBananas()") | |
public void performInventory(); | |
public int countBananas(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment