Package mockit

Examples of mockit.NonStrictExpectations


 
  @Test
  public void project(@Injectable final DrillbitContext bitContext, @Injectable UserClientConnection connection) throws Throwable{


    new NonStrictExpectations(){{
      bitContext.getMetrics(); result = new MetricRegistry("test");
      bitContext.getAllocator(); result = BufferAllocator.getAllocator(c);
    }};
   
   
View Full Code Here


    final BlockLocation[] blockLocations = buildBlockLocations(hosts, blockSize);
    final LinkedList<CoordinationProtos.DrillbitEndpoint> endPoints = buildEndpoints(numberOfHosts);
    buildRowGroups(rowGroups, numberOfBlocks, blockSize, 3);

    new NonStrictExpectations() {{
      fs.getFileBlockLocations(file, 0, 3*blockSize); result = blockLocations;
      fs.getFileStatus(new Path(path)); result = file;
      file.getLen(); result = 3*blockSize;
    }};

View Full Code Here

    public void testLocalCurrentUserInfo() {
        final String userName = "testUser";
        final CurrentUser currentUser = new CurrentUser();
        currentUser.setUser(userName);

        new NonStrictExpectations() {{
            FacesContext.getCurrentInstance(); result = facesContext;
            facesContext.getApplication(); result = application;
            facesContext.getELContext(); result = elContext;
            application.getELResolver(); result = elResolver;
            elResolver.getValue(elContext, null, "currentUser"); result = currentUser;
View Full Code Here

    @Test
    public void testPrincipalCurrentUserInfo() {
        final String userName = "testUser";
        final Principal principal = new BasicUserPrincipal(userName);
        new NonStrictExpectations() {{
            FacesContext.getCurrentInstance(); result = facesContext;
            facesContext.getExternalContext(); result = externalContext;
            externalContext.getUserPrincipal(); result = principal;
        }};
View Full Code Here

        assertEquals(PhaseId.RENDER_RESPONSE, new SecurityPhaseListener().getPhaseId());
    }

    @Test
    public void testPhaseListenerLocalSecurity() throws Exception {
        new NonStrictExpectations() {{
            CmfContext.getInstance(); result = cmfContext;
            FacesContext.getCurrentInstance(); result = facesContext;
            facesContext.getExternalContext(); result = externalContext;
            cmfContext.getCurrentUser(); result = null;
            cmfContext.getSecurityType(); result = SecurityType.LOCAL;
View Full Code Here

    }

    @Test
    public void testPhaseListenerCustomSecurity() throws Exception {
        final String customUrl = "customUrl";
        new NonStrictExpectations() {{
            CmfContext.getInstance(); result = cmfContext;
            FacesContext.getCurrentInstance(); result = facesContext;
            facesContext.getExternalContext(); result = externalContext;
            cmfContext.getCurrentUser(); result = null;
            cmfContext.getSecurityType(); result = SecurityType.CUSTOM;
View Full Code Here

    }

    @Test
    public void testPhaseListenerPrincipalSecurity() throws Exception {

        new NonStrictExpectations() {{
            CmfContext.getInstance(); result = cmfContext;
            FacesContext.getCurrentInstance(); result = facesContext;
            facesContext.getExternalContext(); result = externalContext;
            cmfContext.getCurrentUser(); result = null;
            cmfContext.getSecurityType(); result = SecurityType.PRINCIPAL;
View Full Code Here

    }

    @Test
    public void testPhaseListenerNoneSecurity() throws Exception {

        new NonStrictExpectations() {{
            CmfContext.getInstance(); result = cmfContext;
            FacesContext.getCurrentInstance(); result = facesContext;
            facesContext.getExternalContext(); result = externalContext;
            cmfContext.getCurrentUser(); result = null;
            cmfContext.getSecurityType(); result = SecurityType.NONE;
View Full Code Here

        File cfg = new File("test/net/tralfamadore/config/test-cmf-config.xml");

        final InputStream inputStream = new FileInputStream(cfg);

        try {
            new NonStrictExpectations() {{
                FacesContext.getCurrentInstance(); result = facesContext;
                facesContext.getExternalContext(); result = externalContext;
                externalContext.getResourceAsStream(anyString); result = inputStream;
            }};
View Full Code Here

    @Test
    public void testStart() throws Exception {
        final Namespace parent = Namespace.createFromString("net.tralfamadore");

        new NonStrictExpectations() {
            {
                pageContent.getNamespace(); result = new Delegate() {
                    Namespace returnANamespace() {
                        return parent;
                    }
View Full Code Here

TOP

Related Classes of mockit.NonStrictExpectations

Copyright © 2018 www.massapicom. 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.