Package qubexplorer.ui

Source Code of qubexplorer.ui.AuthenticationRepositoryTest

package qubexplorer.ui;

import org.junit.Test;
import static org.junit.Assert.*;
import qubexplorer.UserCredentials;
import static org.hamcrest.CoreMatchers.*;

/**
*
* @author Victor
*/
public class AuthenticationRepositoryTest {
   
    @Test
    public void shouldContaintAuthentication(){
        AuthenticationRepository repo=AuthenticationRepository.getInstance();
        UserCredentials auth=new UserCredentials("one", "two".toCharArray());
        repo.saveAuthentication("url", "key", auth);
        assertThat(repo.getAuthentication("url", "key"), is(auth));
        assertThat(repo.getAuthentication("url", "key2"), is(auth));
        UserCredentials auth2=new UserCredentials("one", "two".toCharArray());
        repo.saveAuthentication("url2", null, auth2);
        assertThat(repo.getAuthentication("url2", "key"), is(auth2));
        assertThat(repo.getAuthentication("url2", "key2"), is(auth2));
        assertNull(repo.getAuthentication("url3", "key2"));
    }
   
}
TOP

Related Classes of qubexplorer.ui.AuthenticationRepositoryTest

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.