Example usage for java.lang AssertionError AssertionError

List of usage examples for java.lang AssertionError AssertionError

Introduction

In this page you can find the example usage for java.lang AssertionError AssertionError.

Prototype

public AssertionError(double detailMessage) 

Source Link

Document

Constructs an AssertionError with its detail message derived from the specified double, which is converted to a string as defined in section 15.18.1.1 of The Java™ Language Specification.

Usage

From source file:info.rynkowski.hamsterclient.ui.view.activity.FactFormActivity.java

@OnClick({ R.id.et_start_time, R.id.et_end_time })
public void onTimeClicked(final View view) {
    int hour, minutes;

    switch (view.getId()) {
    case R.id.et_start_time:
        hour = selectedStartTime.get(Calendar.HOUR_OF_DAY);
        minutes = selectedStartTime.get(Calendar.MINUTE);
        break;//from w  w  w.  j  a va  2  s  . c  o m
    case R.id.et_end_time:
        hour = selectedEndTime.get(Calendar.HOUR_OF_DAY);
        minutes = selectedEndTime.get(Calendar.MINUTE);
        break;
    default:
        throw new AssertionError("Unknown view id");
    }

    TimePickerDialog timePicker = new TimePickerDialog(FactFormActivity.this,
            (timePickerView, selectedHour, selectedMinutes) -> {
                switch (view.getId()) {
                case R.id.et_start_time:
                    selectedStartTime.set(Calendar.HOUR_OF_DAY, selectedHour);
                    selectedStartTime.set(Calendar.MINUTE, selectedMinutes);
                    editTextStartTime.setText(TimeConverter.toString(selectedStartTime, "HH:mm"));
                    break;
                case R.id.et_end_time:
                    selectedEndTime.set(Calendar.HOUR_OF_DAY, selectedHour);
                    selectedEndTime.set(Calendar.MINUTE, selectedMinutes);
                    editTextEndTime.setText(TimeConverter.toString(selectedEndTime, "HH:mm"));
                    break;
                }
            }, hour, minutes, true);

    timePicker.setTitle("Select Time");
    timePicker.show();
}

From source file:net.uytrewq.jogp.impl.ClientImpl.java

public OgpValues parseText(String html) throws HtmlException {
    try {//from  w  w  w . j  a v a2 s .  co m
        return parse("", new InputSource(new StringReader(html)));
    } catch (IOException e) {
        // IO exception should not be thrown.
        logger.error("string input source should not throw io exception", e);
        throw new AssertionError(e);
    }
}