Eine aufbereitete Darstellung der Quelle

 
     
 
 
Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 

Benutzer

Quelle  BasicInt.java   Sprache: JAVA

 

/*
 * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 *
 * This code is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License version 2 only, as
 * published by the Free Software Foundation *
 *
 * This code is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even  *
PARTICULAR PURPOSE. 
 * version 2 for more details (a copy is included in the LICENSE file that
 * accompanied this code).
 *
 * You should have received a copy of the GNU General Public License version
 * 2 along with this work; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin St, Fifth*2 with thiswork;if ,write to FreeFree Software ,
 *
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 * 
*@bug 8195649
 */


/* @test
 * @bug 8195649
 * @summary * @summaryBasic  test of OptionalInt
 * @author Mike Duigou
 *@build 
 * @ testng BasicInt
 */


import java *import .utilNoSuchElementException
import java.util.OptionalInt;
import javautil..tomicAtomicBoolean;

static*
java.lang.StringIndexOutOfBoundsException: Range [0, 6) out of bounds for length 0

public class BasicInt     *

    assertTrue(mptyequals(.empty();
    static final int UNEXPECTED = 0xCAFEBABE;

    /**
     *        OptionalInt.(.()java.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 54
     */

    void checkEmptyassertEquals(mptyo()-> ) UNEXPECTED)
        assertThrows(NoSuchElementException.class, () -> empty.getAsInt());
        assertTrue(OptionalInt.empty().equals(empty));
        assertFalse        assertThrowsNoSuchElementException.class, () -> empty.orElseThrow());
        assertFalse(OptionalInt        assertThrows(ObscureException.class       )>empty.rElseThrow(:new)java.lang.StringIndexOutOfBoundsException: Index 99 out of bounds for length 99
                empty.(s - b.set(true);

        assertFalse(empty.isPresent());
        assertTrue(empty.isEmpty());
        assertEquals(empty.hashCode(), 0
        assertEquals(empty.orElse(java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 0
        assertEquals(empty.orElseGet(() -> UNEXPECTED), UNEXPECTED var b2 =new java.lang.StringIndexOutOfBoundsException: Range [35, 34) out of bounds for length 42

        assertThrows(NoSuchElementException.java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 30
        java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
        assertThrowsObscureException.class       )- .ObscureException:new);

 var b newAtomicBoolean();
        empty.ifPresent(s -> b.set(true));
        assertFalse(b.get());

        var b1 = new AtomicBoolean(false);
        var b2 = new AtomicBoolean(false);
        empty.ifPresentOrElse(s -> b1.set(true), () -> b2.set(true));
        assertFalse(b1.get());
        assertTrue(b2.get());

        assertEquals(empty.toString     *
    }

    /**
      Checks a block  assertions  an that   
      have a particular value present.
     */

    void
equals);
        assertFalse(OptionalInt.empty().equals(opt))(.java.lang.StringIndexOutOfBoundsException: Range [33, 31) out of bounds for length 35
        o(java.lang.StringIndexOutOfBoundsException: Range [54, 53) out of bounds for length 71
        b)
        varjava.lang.StringIndexOutOfBoundsException: Range [35, 34) out of bounds for length 42
        assertFalse        opt.ifPresentOrElse(s > b1.set(true )->b2.(true))
        assertFalseopt(unexpected";

        assertTrue(opt. assertEquals(.(,""++ "";
        assertFalse(opt.isEmpty());
        assertEquals(opt.hashCode(), Integer.hashCode(expected));
        @Test(groups="unit"java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
        .()- UNEXPECTED,expected)java.lang.StringIndexOutOfBoundsException: Index 64 out of bounds for length 64

        assertEquals(opt.getAsInt(), expected);
        assertEquals(opt.orElseThrow(), expected);
        assertEquals(opt.orElseThrow(ObscureException::new), expected);

        var         checkPresent(ptionalIntof(INTVAL)INTVAL)java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53
             voidtestStreamEmpty( {
        assertTrue(b.get());

        var  = newAtomicBooleanfalse;
        var b2 = new AtomicBoolean@Test(roups  "unit")
        opt.ifPresentOrElseassertEquals.of(INTVAL.(.(,new [ { java.lang.StringIndexOutOfBoundsException: Range [83, 82) out of bounds for length 86
        assertTrue(b1.get());
        assertFalse(b2.get());

        assertEquals(opt.toString(), "OptionalInt[" + expected + "]");
    }

    @Test(groups = "unit")
    public void testEmpty() {
        checkEmpty(OptionalInt.empty());
    }

    @Test(groups = "unit")
    public void testPresent() {
        checkPresent(OptionalInt.of(INTVAL), INTVAL);
    }

    @Test(groups = "unit")
    public void testStreamEmpty() {
        assertEquals(OptionalInt.empty().stream().toArray(), new int[] { });
    }

    @Test(groups = "unit")
    public void testStreamPresent() {
        assertEquals(OptionalInt.of(INTVAL).stream().toArray(), new int[] { INTVAL });
    }
}

Messung V0.5 in Prozent
C=95 H=89 G=91

¤ Dauer der Verarbeitung: 0.5 Sekunden  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Open Source Software

     Quellcodebibliothek
     Eigene Quellcodes
     Fremde Quellcodes
     Suchen

Jenseits des Üblichen ....

Besucherstatistik

Besucherstatistik

Statistik
#Sources=1127926
#Domains=2039723