Example usage for org.springframework.util Assert notEmpty

List of usage examples for org.springframework.util Assert notEmpty

Introduction

In this page you can find the example usage for org.springframework.util Assert notEmpty.

Prototype

@Deprecated
public static void notEmpty(@Nullable Map<?, ?> map) 

Source Link

Document

Assert that a Map contains entries; that is, it must not be null and must contain at least one entry.

Usage

From source file:org.oncoblocks.centromere.sql.test.GenericJdbcRepositoryTests.java

@Test
public void findAllTest() {
    List<Subject> subjects = subjectRepository.findAll();
    Assert.notNull(subjects);// www .  j  av a 2 s .  c o m
    Assert.notEmpty(subjects);
    Assert.isTrue(subjects.size() == 5);
    Subject subject = subjects.get(0);
    Assert.notNull(subject);
    Assert.isTrue(subject.getId().equals(1L));
    Assert.isTrue(subject.getName().equals("PersonA"));
}

From source file:com.autentia.wuija.trace.Tracer.java

public Tracer(String applicationName, Map<String, List<TraceProcessor>> traceProcessors) {
    Assert.hasText(applicationName, "application cannot be empty");
    Assert.notEmpty(traceProcessors);
    this.application = applicationName;
    processorsCache.putAll(traceProcessors);
}

From source file:demo.service.impl.DefaultKmlService.java

@Override
public final void setupKmlIntegration(Set<Long> intanceIds, Point lookAtPoint, String kmlUrl) {
    Assert.notEmpty(intanceIds);
    Assert.isTrue(intanceIds.size() >= 1);

    Kml kml = KmlFactory.createKml();/*from  www .ja  va 2  s .c om*/
    Document folder = KmlFactory.createDocument();
    folder.setOpen(true);
    folder.setName("Contains GPS Coordinates");
    kml.setFeature(folder);

    final LookAt lookAt = KmlFactory.createLookAt();
    lookAt.setLatitude(lookAtPoint.getLatitude());
    lookAt.setLongitude(lookAtPoint.getLongitude());
    lookAt.setAltitude(25000);
    lookAt.setAltitudeMode(AltitudeMode.ABSOLUTE);
    ;
    folder.setAbstractView(lookAt);

    for (long instanceId : intanceIds) {
        Link link = KmlFactory.createLink();
        link.setHref(kmlUrl + instanceId);
        link.setRefreshMode(RefreshMode.ON_INTERVAL);
        link.setRefreshInterval(1d);

        NetworkLink networkLink = KmlFactory.createNetworkLink();
        networkLink.setName("GPS link " + instanceId);
        networkLink.setOpen(true);
        networkLink.setLink(link);
        folder.addToFeature(networkLink);
    }

    final ByteArrayOutputStream out = new ByteArrayOutputStream();

    try {
        this.marshaller.marshal(kml, new StreamResult(out));
    } catch (XmlMappingException | IOException e) {
        throw new IllegalStateException(e);
    }

    this.kmlBootstrap = out.toByteArray();
}

From source file:org.netxilia.api.impl.command.RefreshCellCommand.java

public RefreshCellCommand(ISheet mainSheet, List<CellReference> refreshCells, boolean stopPropagation) {
    super(AreaReference.ALL, stopPropagation);
    Assert.notNull(refreshCells);/*from   w w  w .  j  av  a  2  s .  c o m*/
    Assert.notEmpty(refreshCells);
    this.refreshCells = ImmutableList.copyOf(refreshCells);
    currentCell = new AreaReference(refreshCells.get(0));
    this.mainSheet = mainSheet;
}

From source file:org.oncoblocks.centromere.sql.test.SqlBuilderTests.java

@Test
public void simpleAndQueryTest() {

    SqlBuilder sqlBuilder = new SqlBuilder(tableDescription);
    sqlBuilder.where(and(equal("name", "Joe"), equal("species", "human")));

    String sql = sqlBuilder.toSql();
    System.out.println(sql);//from   ww w  . ja  v  a2 s .  com
    Assert.notNull(sql);

    List<Object> values = sqlBuilder.getQueryParameterValues();
    Assert.notNull(values);
    Assert.notEmpty(values);
    Assert.isTrue(values.size() == 2);
    String name = (String) values.get(0);
    Assert.isTrue("Joe".equals(name));

}

From source file:org.hdiv.config.annotation.condition.OnFrameworkCondition.java

public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) {

    MultiValueMap<String, Object> attributes = metadata
            .getAllAnnotationAttributes(ConditionalOnFramework.class.getName(), true);

    List<Object> values = attributes.get("value");
    Assert.notEmpty(values);
    SupportedFramework frwk = (SupportedFramework) values.get(0);

    if (frwk == SupportedFramework.SPRING_MVC) {
        return springMvcModulePresent;
    } else if (frwk == SupportedFramework.THYMELEAF) {
        return thymeleafModulePresent;
    } else if (frwk == SupportedFramework.GRAILS) {
        return grailsPresent && grailsModulePresent;
    } else if (frwk == SupportedFramework.JSF) {
        return jsfPresent && jsfModulePresent;
    } else {//from w w  w  . ja  va  2s  .c o  m
        return false;
    }
}

From source file:org.red5.server.script.jython.JythonScriptFactory.java

@SuppressWarnings({ "rawtypes" })
public JythonScriptFactory(String scriptSourceLocator, Class[] scriptInterfaces, Object[] arguments) {
    Assert.hasText(scriptSourceLocator);
    Assert.notEmpty(scriptInterfaces);
    this.scriptSourceLocator = scriptSourceLocator;
    this.scriptInterfaces = scriptInterfaces;
    if (arguments == null || arguments.length == 0) {
        this.arguments = null;
    } else {//  ww  w  .  j  a v a2s .  com
        this.arguments = arguments;
    }
}

From source file:org.oncoblocks.centromere.mongodb.test.GenericMongoRepositoryTests.java

@Test
public void findAllTest() {

    List<EntrezGene> genes = geneRepository.findAll();
    Assert.notNull(genes);/*w w w  .  ja  v a 2 s .  co  m*/
    Assert.notEmpty(genes);
    Assert.isTrue(genes.size() == 5);

    EntrezGene gene = genes.get(0);
    Assert.notNull(gene);
    Assert.isTrue(gene.getEntrezGeneId().equals(1L));
    Assert.isTrue("GeneA".equals(gene.getPrimaryGeneSymbol()));
    Assert.notNull(gene.getAliases());
    Assert.notEmpty(gene.getAliases());
    Assert.isTrue(gene.getAliases().size() == 1);
    System.out.println(gene.toString());

}

From source file:org.oncoblocks.centromere.jpa.test.JpaRepositoryTests.java

@Test
public void findByIdTest() {

    EntrezGene gene = geneRepository.findOne(1L);
    Assert.notNull(gene);/*w  ww  . j  a va2s . c o  m*/
    Assert.isTrue(gene.getEntrezGeneId().equals(1L));
    Assert.isTrue("GeneA".equals(gene.getPrimaryGeneSymbol()));
    Assert.notNull(gene.getAliases());
    Assert.notEmpty(gene.getAliases());
    Assert.isTrue(gene.getAliases().size() == 1);

}

From source file:org.oncoblocks.centromere.sql.test.GenericJdbcRepositoryTests.java

@Test
public void findAllSorted() {
    List<Subject> subjects = subjectRepository
            .findAll(new Sort(new Sort.Order(Sort.Direction.DESC, "subjects.subject_id")));
    Assert.notNull(subjects);//from www .  j a v  a2s  .c  om
    Assert.notEmpty(subjects);
    Subject subject = subjects.get(0);
    Assert.notNull(subject);
    Assert.isTrue(subject.getId().equals(5L));
    Assert.isTrue(subject.getName().equals("A375"));
}