1 16 17 package org.apache.commons.latka.validators; 18 19 import org.apache.commons.latka.ValidationException; 20 21 import org.apache.commons.latka.http.Response; 22 23 35 public class StatusTextValidator extends BaseValidator { 36 37 39 protected String _statusText = null; 40 41 43 public StatusTextValidator() { 44 this(null,null); 45 } 46 47 public StatusTextValidator(String label, String text) { 48 super(label); 49 _statusText = text; 50 } 51 52 54 public void setStatusText(String text) { 55 _statusText = text; 56 } 57 58 public void validate(Response response) 59 throws ValidationException { 60 61 String responseStatusText = response.getStatusText(); 62 if (!_statusText.equals(responseStatusText)) { 63 fail("EXPECTED STATUS TEXT '" + _statusText + "', FOUND '" + responseStatusText + 64 "'"); 65 } 66 } 67 } 68 | Popular Tags |