Example usage for java.lang Integer equals

List of usage examples for java.lang Integer equals

Introduction

In this page you can find the example usage for java.lang Integer equals.

Prototype

public boolean equals(Object obj) 

Source Link

Document

Compares this object to the specified object.

Usage

From source file:ch.ralscha.extdirectspring.provider.RemoteProviderMetadata.java

@ExtDirectMethod(value = ExtDirectMethodType.STORE_READ, group = "metadata")
public ExtDirectStoreResult<Row> method6(ExtDirectStoreReadRequest request, Locale locale,
        @MetadataParam Optional<Integer> id) {

    Integer i = id.orElse(20);
    assertThat(request.getParams().isEmpty()).isTrue();
    if (!i.equals(20)) {
        assertThat(i).isEqualTo(10);//from w ww. j av  a2 s  .  c om
    } else {
        assertThat(i).isEqualTo(20);
    }
    assertThat(locale).isEqualTo(Locale.ENGLISH);

    return RemoteProviderStoreRead.createExtDirectStoreResult(request, ":" + i + ";" + locale);
}

From source file:org.bozzo.ipplan.web.AddressPlanController.java

@RequestMapping(value = "/{planId}", method = RequestMethod.PUT, produces = {
        MediaType.APPLICATION_JSON_VALUE })
public HttpEntity<AddressPlanResource> updateAddressPlan(@PathVariable Integer infraId,
        @PathVariable Long planId, @RequestBody @NotNull AddressPlan plan) {
    Preconditions.checkArgument(infraId.equals(plan.getInfraId()));
    Preconditions.checkArgument(planId.equals(plan.getId()));
    logger.info("update address plan: {}", plan);

    AddressPlan ap = this.repository.save(plan);
    return new ResponseEntity<>(assembler.toResource(ap), HttpStatus.CREATED);
}

From source file:org.bozzo.ipplan.web.InfrastructureController.java

@ApiResponses({ @ApiResponse(code = 201, message = "Created") })
@RequestMapping(value = "/{infraId}", method = RequestMethod.PUT, produces = {
        MediaType.APPLICATION_JSON_VALUE })
public HttpEntity<InfrastructureResource> updateInfrastructure(@PathVariable Integer infraId,
        @RequestBody @NotNull Infrastructure infra) {
    Preconditions.checkArgument(infraId.equals(infra.getId()));
    logger.info("update infrastruture: {}", infra);
    Infrastructure infrastructure = repository.save(infra);
    return new ResponseEntity<>(assembler.toResource(infrastructure), HttpStatus.CREATED);
}

From source file:com._8x8.logic.service.UserPhoneLogProvider.java

@Override
public List<UserPhoneLogList> getUserPhoneLogList() {
    List<UserPhoneLogList> mUserPhoneLogList = new ArrayList<>();
    List<User> mUser = _userRepository.GetUsers();
    List<UserPhoneLog> mAllUserPhoneLogs = _userPhoneLogRepository.getAllUserPhoneLog();

    for (User mUserData : mUser) {
        Integer userId = mUserData.getId();
        String fullname = mUserData.getFirstname() + " " + mUserData.getLastname();
        int totalAnswer = 0;
        int totalTransfer = 0;
        int totalMissed = 0;

        List<UserPhoneLog> mUserPhoneLogs = new ArrayList<>();
        Integer tempUserId;
        for (UserPhoneLog allUserPhoneLogData : mAllUserPhoneLogs) {
            tempUserId = allUserPhoneLogData.getUserId();
            if (tempUserId.equals(userId)) {
                mUserPhoneLogs.add(allUserPhoneLogData);
            }//from www. j av  a2s.c  om
        }

        for (UserPhoneLog userPhoneLogData : mUserPhoneLogs) {
            if (userPhoneLogData.getAnswer()) {
                totalAnswer++;
            }
        }
        for (UserPhoneLog userPhoneLogData : mUserPhoneLogs) {
            if (userPhoneLogData.getTrasfer()) {
                totalTransfer++;
            }
        }
        for (UserPhoneLog userPhoneLog1 : mUserPhoneLogs) {
            if (userPhoneLog1.getMissed()) {
                totalMissed++;
            }
        }
        mUserPhoneLogList.add(new UserPhoneLogList(userId, fullname, totalAnswer, totalTransfer, totalMissed));
    }

    return mUserPhoneLogList;
}

From source file:br.com.dropegroup.dprf.dao.mock.OcorrenciaMockDAO.java

@Override
public List<OcorrenciaAgrupamentoVO> find(Integer ano) {
    List<OcorrenciaAgrupamentoVO> result = new ArrayList<OcorrenciaAgrupamentoVO>();
    for (OcorrenciaAgrupamentoVO x : oaVoList) {
        if (ano.equals(x.getAno())) {
            result.add(x);//from   w  w w.  j  av a2 s. co m
        }
    }
    return result;
}

From source file:org.bozzo.ipplan.web.ZoneController.java

@RequestMapping(value = "/{zoneId}", method = RequestMethod.PUT, produces = {
        MediaType.APPLICATION_JSON_VALUE })
public HttpEntity<ZoneResource> updateZone(@PathVariable Integer infraId, @PathVariable Long zoneId,
        @RequestBody @NotNull Zone zone) {
    Preconditions.checkArgument(infraId.equals(zone.getInfraId()));
    Preconditions.checkArgument(zoneId.equals(zone.getId()));
    logger.info("update zone: {}", zone);
    Zone zon = repository.save(zone);/*from   w w w. j a  v  a  2s.  co  m*/
    return new ResponseEntity<>(assembler.toResource(zon), HttpStatus.CREATED);
}

From source file:com.fitbur.jestify.junit.spring.injector.IndexMockInjector.java

@Override
public void inject() {
    Map<DescriptorKey, ParameterDescriptor> parameterDescriptors = context.getParamaterDescriptors();
    Field field = fieldDescriptor.getField();

    Mock mock = fieldDescriptor.getMock().get();
    Integer index = mock.index();
    Optional<ParameterDescriptor> optional = parameterDescriptors.values().parallelStream()
            .filter(p -> index.equals(p.getIndex())).findFirst();

    ParameterDescriptor parameterDescriptor = optional.get();
    Parameter parameter = parameterDescriptor.getParameter();

    Type fieldType = field.getGenericType();
    Type parameterType = parameter.getParameterizedType();

    checkArgument(fieldType.equals(parameterType),
            "Can not mock field '%s'. Test class field type '%s' and class under test "
                    + "constructor parameter type '%s' at '%d' index do not match.",
            field.getName(), field.getGenericType(), parameterType, index);

    ResolvableType resolver = ResolvableType.forType(parameterType);

    Class rawType;/* w w  w.  j a  v  a2  s  .c  o m*/

    if (resolver.hasGenerics()) {
        if (resolver.isAssignableFrom(Provider.class) || resolver.isAssignableFrom(Optional.class)) {
            rawType = resolver.getRawClass();
        } else {
            rawType = resolver.resolve();
        }
    } else {
        rawType = (Class) parameterType;
    }

    checkArgument(arguments[index] == null,
            "Can not mock field '%s'. Multipe test class fields have the same index of '%d'", field.getName(),
            index);

    Object instance = testReifier.reifyField(fieldDescriptor, parameterDescriptor);
    arguments[index] = instance;
}

From source file:hr.fer.zemris.vhdllab.dao.impl.BaseEntityDaoTest.java

/**
 * Id is set./*from  ww w  .  j  ava 2 s .co  m*/
 */
@Test
public void persistIdSet() {
    Integer id = 1000;
    entity.setId(id);
    dao.persist(entity);
    assertFalse("entity is persisted with specified id.", id.equals(entity.getId()));
    assertNotNull("entity not persisted.", dao.load(entity.getId()));
    assertNull("entity persisted with specified id.", dao.load(id));
}

From source file:iwein.samples.store.SimpleMessageGroup.java

/**
 * This method determines whether messages have been added to this group that supersede the given message based on
 * its sequence id. This can be helpful to avoid ending up with sequences larger than their required sequence size
 * or sequences that are missing certain sequence numbers.
 *//*from   w  w  w.j a  v  a  2 s .c o m*/
private boolean isMember(Message<?> message) {
    if (size() == 0) {
        return false;
    }
    Integer messageSequenceNumber = message.getHeaders().getSequenceNumber();
    if (messageSequenceNumber != null && messageSequenceNumber > 0) {
        Integer messageSequenceSize = message.getHeaders().getSequenceSize();
        if (!messageSequenceSize.equals(getSequenceSize())) {
            return true;
        } else {
            synchronized (lock) {
                if (containsSequenceNumber(unmarked, messageSequenceNumber)
                        || containsSequenceNumber(marked, messageSequenceNumber)) {
                    return true;
                }
            }
        }
    }
    return false;
}

From source file:br.com.dropegroup.dprf.dao.mock.OcorrenciaMockDAO.java

@Override
public List<OcorrenciaAgrupamentoVO> find(Integer ano, Integer mes) {
    List<OcorrenciaAgrupamentoVO> result = new ArrayList<OcorrenciaAgrupamentoVO>();
    for (OcorrenciaAgrupamentoVO x : oaVoList) {
        if (ano.equals(x.getAno()) && mes.equals(x.getMes())) {
            result.add(x);/*www . j a v  a2s. c  o  m*/
        }
    }
    return result;
}