001/* 002 * acme4j - Java ACME client 003 * 004 * Copyright (C) 2015 Richard "Shred" Körber 005 * http://acme4j.shredzone.org 006 * 007 * Licensed under the Apache License, Version 2.0 (the "License"); 008 * you may not use this file except in compliance with the License. 009 * 010 * This program is distributed in the hope that it will be useful, 011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 013 */ 014package org.shredzone.acme4j; 015 016import static org.assertj.core.api.Assertions.assertThat; 017 018import java.util.Locale; 019 020import org.junit.jupiter.api.Test; 021 022/** 023 * Unit tests for {@link Status} enumeration. 024 */ 025public class StatusTest { 026 027 /** 028 * Test that invoking {@link Status#parse(String)} gives the correct status. 029 */ 030 @Test 031 public void testParse() { 032 // Would break toUpperCase() if English locale is not set, see #156. 033 Locale.setDefault(new Locale("tr")); 034 035 for (var s : Status.values()) { 036 var parsed = Status.parse(s.name().toLowerCase(Locale.ENGLISH)); 037 assertThat(parsed).isEqualTo(s); 038 } 039 040 // unknown status returns UNKNOWN 041 assertThat(Status.parse("foo")).isEqualTo(Status.UNKNOWN); 042 } 043 044}