public class Pen {
private int inkContainerValue = 1000;
private double sizeLetter = 1.0;
private String color = "BLUE";
public String write(String word) {
if (!isWork()) {
return "";
}
double sizeOfWord = word.length() * sizeLetter;
if (sizeOfWord <= inkContainerValue) {
inkContainerValue -= sizeOfWord;
return word;
}
String partOfWord = word.substring(0, inkContainerValue);
inkContainerValue = 0;
return partOfWord;
}
Help write a testNG test for the method - public String write (String word) for the other methods I wrote tests
Aucun commentaire:
Enregistrer un commentaire