Package com.wesabe.grendel.modules.tests

Source Code of com.wesabe.grendel.modules.tests.SecureRandomProviderTest

package com.wesabe.grendel.modules.tests;

import static org.fest.assertions.Assertions.*;

import java.security.SecureRandom;
import java.util.logging.Level;
import java.util.logging.Logger;

import org.junit.Before;
import org.junit.Test;
import org.junit.experimental.runners.Enclosed;
import org.junit.runner.RunWith;

import com.wesabe.grendel.modules.SecureRandomProvider;

@RunWith(Enclosed.class)
public class SecureRandomProviderTest {
  public static class Providing_A_CSPRNG {
    private SecureRandomProvider provider;
   
    @Before
    public void setup() throws Exception {
      Logger.getLogger(SecureRandomProvider.class.getCanonicalName()).setLevel(Level.OFF);
      this.provider = new SecureRandomProvider();
    }
   
    @Test
    public void itProvidesASecureRandomInstance() throws Exception {
      assertThat(provider.get()).isInstanceOfAny(SecureRandom.class);
    }
   
    @Test
    public void itProvidesTheSameInstance() throws Exception {
      assertThat(provider.get()).isSameAs(provider.get());
    }
  }
}
TOP

Related Classes of com.wesabe.grendel.modules.tests.SecureRandomProviderTest

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.
e.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-20639858-1', 'auto'); ga('send', 'pageview');