Example usage for junit.framework Assert assertFalse

List of usage examples for junit.framework Assert assertFalse

Introduction

In this page you can find the example usage for junit.framework Assert assertFalse.

Prototype

static public void assertFalse(boolean condition) 

Source Link

Document

Asserts that a condition is false.

Usage

From source file:io.cloudslang.lang.compiler.modeller.transformers.DoTransformerTest.java

@Test
public void testTransformConst() throws Exception {
    Map doArgumentsMap = loadFirstTaskFromFile("/flow_with_data.yaml");
    @SuppressWarnings("unchecked")
    List<Argument> arguments = doTransformer.transform(doArgumentsMap);
    Assert.assertFalse(arguments.isEmpty());
    Assert.assertEquals(2, arguments.size());
    Argument argument = arguments.get(1);
    Assert.assertEquals("country", argument.getName());
    Assert.assertEquals("Israel", argument.getValue());
}

From source file:org.geomajas.gwt2.client.map.layer.VectorLayerEventTest.java

@Test
public void testMarkedAsVisibleEvents() {
    VectorServerLayerImpl layer = new VectorServerLayerImpl(mapConfig, layerInfo, viewPort, eventBus);
    count = 0;//from  w w  w .  j  a v  a  2s  . c om

    eventBus.addLayerVisibilityHandler(new LayerVisibilityHandler() {

        public void onVisibilityMarked(LayerVisibilityMarkedEvent event) {
            count++;
        }

        public void onShow(LayerShowEvent event) {
        }

        public void onHide(LayerHideEvent event) {
        }
    });

    // Scale between 6 and 20 is OK:
    viewPort.applyResolution(viewPort.getResolution(0)); // 32 -> NOK
    Assert.assertFalse(layer.isShowing());
    Assert.assertEquals(0, count);

    layer.setMarkedAsVisible(true);
    Assert.assertEquals(1, count);
    layer.setMarkedAsVisible(false);
    Assert.assertEquals(2, count);
}

From source file:ejportal.webapp.action.JournalActionTest.java

/**
 * Test save./*from ww  w  . ja va 2 s  .  c  om*/
 * 
 * @throws Exception
 *             the exception
 */
public void testSave() throws Exception {
    final MockHttpServletRequest request = new MockHttpServletRequest();
    ServletActionContext.setRequest(request);
    this.action.setJournalId(1L);
    Assert.assertEquals("edit", this.action.edit());
    Assert.assertNotNull(this.action.getJournalBaseTO());

    // update Kurztitel and save
    this.action.getJournalBaseTO().setTitel("Updated Kurztitel");
    Assert.assertEquals("success", this.action.save());
    Assert.assertEquals("Updated Kurztitel", this.action.getJournalBaseTO().getTitel());
    Assert.assertFalse(this.action.hasActionErrors());
    Assert.assertFalse(this.action.hasFieldErrors());
    Assert.assertNotNull(request.getSession().getAttribute("messages"));
}

From source file:ejportal.webapp.action.SignupActionTest.java

/**
 * Test execute./*from   w ww.java2  s . c  o  m*/
 * 
 * @throws Exception
 *             the exception
 */
public void testExecute() throws Exception {
    final User user = new User();
    user.setUsername("self-registered");
    user.setPassword("Password1");
    user.setConfirmPassword("Password1");
    user.setFirstName("First");
    user.setLastName("Last");

    final Address address = new Address();
    address.setCity("Denver");
    address.setProvince("CO");
    address.setCountry("USA");
    address.setPostalCode("80210");
    user.setAddress(address);

    user.setEmail("self-registered@raibledesigns.com");
    user.setWebsite("http://raibledesigns.com");
    user.setPasswordHint("Password is one with you.");
    this.action.setUser(user);

    // set mock response so setting cookies doesn't fail
    ServletActionContext.setResponse(new MockHttpServletResponse());

    // start SMTP Server
    final Wiser wiser = new Wiser();
    wiser.setPort(this.getSmtpPort());
    wiser.start();

    Assert.assertEquals("success", this.action.save());
    Assert.assertFalse(this.action.hasActionErrors());

    // verify an account information e-mail was sent
    wiser.stop();
    Assert.assertTrue(wiser.getMessages().size() == 1);

    // verify that success messages are in the session
    Assert.assertNotNull(this.action.getSession().getAttribute(Constants.REGISTERED));

    SecurityContextHolder.getContext().setAuthentication(null);
}

From source file:ejportal.webapp.action.UserActionTest.java

/**
 * Test save./*from   ww  w . j  a v  a 2 s.  co  m*/
 * 
 * @throws Exception
 *             the exception
 */
public void testSave() throws Exception {
    final UserManager userManager = (UserManager) this.applicationContext.getBean("userManager");
    final User user = userManager.getUserByUsername("user");
    user.setPassword("user");
    user.setConfirmPassword("user");
    this.action.setUser(user);
    this.action.setFrom("list");

    final MockHttpServletRequest request = new MockHttpServletRequest();
    request.addParameter("encryptPass", "true");
    ServletActionContext.setRequest(request);

    Assert.assertEquals("input", this.action.save());
    Assert.assertNotNull(this.action.getUser());
    Assert.assertFalse(this.action.hasActionErrors());
}

From source file:ejportal.webapp.action.KonsortiumActionTest.java

/**
 * Test save./*w  w w  .j av  a  2s .c  o m*/
 * 
 * @throws Exception
 *             the exception
 */
public void testSave() throws Exception {
    final MockHttpServletRequest request = new MockHttpServletRequest();
    ServletActionContext.setRequest(request);
    this.action.setKonsortiumId(1L);
    Assert.assertEquals("edit", this.action.edit());
    Assert.assertNotNull(this.action.getKonsortium());

    // update Name and save
    this.action.getKonsortium().setKonsortiumName("Updated Name");
    Assert.assertEquals("success", this.action.save());
    Assert.assertEquals("Updated Name", this.action.getKonsortium().getKonsortiumName());
    Assert.assertFalse(this.action.hasActionErrors());
    Assert.assertFalse(this.action.hasFieldErrors());
    Assert.assertNotNull(request.getSession().getAttribute("messages"));
}

From source file:edu.uci.ics.jung.io.TestGraphMLReader.java

public void testLoad() throws IOException {
    String testFilename = "toy_graph.ml";

    Graph<Number, Number> graph = loadGraph(testFilename);

    Assert.assertEquals(graph.getVertexCount(), 3);
    Assert.assertEquals(graph.getEdgeCount(), 3);

    BidiMap<Number, String> vertex_ids = gmlreader.getVertexIDs();

    Number joe = vertex_ids.getKey("1");
    Number bob = vertex_ids.getKey("2");
    Number sue = vertex_ids.getKey("3");

    Assert.assertNotNull(joe);//  www  .  j a  va  2  s  .  c  om
    Assert.assertNotNull(bob);
    Assert.assertNotNull(sue);

    Map<String, GraphMLMetadata<Number>> vertex_metadata = gmlreader.getVertexMetadata();
    Transformer<Number, String> name = vertex_metadata.get("name").transformer;
    Assert.assertEquals(name.transform(joe), "Joe");
    Assert.assertEquals(name.transform(bob), "Bob");
    Assert.assertEquals(name.transform(sue), "Sue");

    Assert.assertTrue(graph.isPredecessor(joe, bob));
    Assert.assertTrue(graph.isPredecessor(bob, joe));
    Assert.assertTrue(graph.isPredecessor(sue, joe));
    Assert.assertFalse(graph.isPredecessor(joe, sue));
    Assert.assertFalse(graph.isPredecessor(sue, bob));
    Assert.assertFalse(graph.isPredecessor(bob, sue));

    File testFile = new File(testFilename);
    testFile.delete();
}

From source file:ejportal.webapp.action.InstitutionActionTest.java

/**
 * Test save./*w  w  w .  j a v a 2s  . c o m*/
 * 
 * @throws Exception
 *             the exception
 */
public void testSave() throws Exception {
    final MockHttpServletRequest request = new MockHttpServletRequest();
    ServletActionContext.setRequest(request);
    this.action.setId(1L);
    Assert.assertEquals("edit", this.action.edit());
    Assert.assertNotNull(this.action.getInstitutionBaseTO());

    // update Name and save
    this.action.getInstitutionBaseTO().setName("Updated Name");
    Assert.assertEquals("success", this.action.save());
    Assert.assertEquals("Updated Name", this.action.getInstitutionBaseTO().getName());
    Assert.assertFalse(this.action.hasActionErrors());
    Assert.assertFalse(this.action.hasFieldErrors());
    Assert.assertNotNull(request.getSession().getAttribute("messages"));
}

From source file:ejportal.webapp.action.JournalkostenActionTest.java

/**
 * Test save.// ww  w . ja  v a2s. co  m
 * 
 * @throws Exception
 *             the exception
 */
public void testSave() throws Exception {
    final MockHttpServletRequest request = new MockHttpServletRequest();
    ServletActionContext.setRequest(request);
    this.action.setJournalkostenId(1L);
    this.action.setJournalId(1L);
    Assert.assertEquals("edit", this.action.edit());
    Assert.assertNotNull(this.action.getJournalkosten());

    // update Journalkosten and save
    this.action.getJournalkosten().setOPreisPO((long) 123.23);
    Assert.assertEquals("success", this.action.save());
    Assert.assertEquals((long) 123.23, (long) this.action.getJournalkosten().getOPreisPO());
    Assert.assertFalse(this.action.hasActionErrors());
    Assert.assertFalse(this.action.hasFieldErrors());
    Assert.assertNotNull(request.getSession().getAttribute("messages"));
}

From source file:ejportal.webapp.action.ExemplarActionTest.java

/**
 * Test save.//from   www.j a va  2  s . c om
 * 
 * @throws Exception
 *             the exception
 */
public void testSave() throws Exception {
    final MockHttpServletRequest request = new MockHttpServletRequest();
    ServletActionContext.setRequest(request);
    this.action.setExemplarId(1L);
    Assert.assertEquals("edit", this.action.edit());
    Assert.assertNotNull(this.action.getExemplarBaseTO());

    // update Name and save
    this.action.getExemplarBaseTO().setForm("Updated Form");
    Assert.assertEquals("success", this.action.save());
    Assert.assertEquals("Updated Form", this.action.getExemplarBaseTO().getForm());
    Assert.assertFalse(this.action.hasActionErrors());
    Assert.assertFalse(this.action.hasFieldErrors());
    Assert.assertNotNull(request.getSession().getAttribute("messages"));
}