Search in sources :

Example 1 with Certificate

use of com.hotels.styx.api.extension.service.Certificate in project styx by ExpediaGroup.

the class TlsSettingsTest method isImmutable.

@Test
public void isImmutable() throws Exception {
    List<String> protocols = new ArrayList<String>() {

        {
            add("TLSv1");
        }
    };
    List<String> cipherSuites = new ArrayList<String>() {

        {
            add("x");
        }
    };
    Certificate[] certificates = new Certificate[] { certificate("x", "x") };
    TlsSettings tlsSettings = new TlsSettings.Builder().additionalCerts(certificates).protocols(protocols).cipherSuites(cipherSuites).build();
    protocols.add("TLSv1.2");
    cipherSuites.add("y");
    certificates[0] = certificate("y", "y");
    assertThat(tlsSettings.protocols(), equalTo(List.of("TLSv1")));
    assertThat(tlsSettings.cipherSuites(), equalTo(List.of("x")));
    assertThat(tlsSettings.additionalCerts(), equalTo(Set.of(certificate("x", "x"))));
}
Also used : ArrayList(java.util.ArrayList) Matchers.containsString(org.hamcrest.Matchers.containsString) Certificate(com.hotels.styx.api.extension.service.Certificate) TlsSettings(com.hotels.styx.api.extension.service.TlsSettings) Test(org.junit.jupiter.api.Test)

Aggregations

Certificate (com.hotels.styx.api.extension.service.Certificate)1 TlsSettings (com.hotels.styx.api.extension.service.TlsSettings)1 ArrayList (java.util.ArrayList)1 Matchers.containsString (org.hamcrest.Matchers.containsString)1 Test (org.junit.jupiter.api.Test)1